[C ++] Gerçek Zamanlı item_blend Simgeleri

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

Admin

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

Bu Özellik Uzun Zamandır Başka Bir Forumda Mevcuttu Zaten.

Anlatım Gayet Açıktır Hata Almanız Mümkün Değildir.






src/Server/common/service.h ile src/Client/UserInterface/Locale_inc.h


EKLE


Kod:
#define ENABLE_NEW_AFFECT_POTION


InstanceBase.h


ARAT


Kod:
NEW_AFFECT_NOG_POCKET_ABILITY = 302,


EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION             AFFECT_POTION_1 = 303,             AFFECT_POTION_2 = 304,             AFFECT_POTION_3 = 305,             AFFECT_POTION_4 = 306,             AFFECT_POTION_5 = 307,             AFFECT_POTION_6 = 308, #endif


PythonCharacterModule.cpp


ARAT


Kod:
PyModule_AddIntConstant(poModule, "NEW_AFFECT_DRAGON_SOUL_DECK2",        CInstanceBase::NEW_AFFECT_DRAGON_SOUL_DECK2);


EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION     PyModule_AddIntConstant(poModule, "AFFECT_POTION_1",        CInstanceBase::AFFECT_POTION_1);     PyModule_AddIntConstant(poModule, "AFFECT_POTION_2",        CInstanceBase::AFFECT_POTION_2);     PyModule_AddIntConstant(poModule, "AFFECT_POTION_3",        CInstanceBase::AFFECT_POTION_3);     PyModule_AddIntConstant(poModule, "AFFECT_POTION_4",        CInstanceBase::AFFECT_POTION_4);     PyModule_AddIntConstant(poModule, "AFFECT_POTION_5",        CInstanceBase::AFFECT_POTION_5);     PyModule_AddIntConstant(poModule, "AFFECT_POTION_6",        CInstanceBase::AFFECT_POTION_6); #endif


PythonApplicationModule.cpp


ARAT


Kod:
#ifdef ENABLE_COSTUME_SYSTEM     PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",    1); #else     PyModule_AddIntConstant(poModule, "ENABLE_COSTUME_SYSTEM",    0); #endif


EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION     PyModule_AddIntConstant(poModule, "ENABLE_NEW_AFFECT_POTION",    1); #else     PyModule_AddIntConstant(poModule, "ENABLE_NEW_AFFECT_POTION",    0); #endif


src/Server/game/src/affect.h


ARAT


Kod:
AFFECT_HOLLY_STONE_POWER = 303,


SIL VE EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION         AFFECT_POTION_1,     AFFECT_POTION_2,     AFFECT_POTION_3,     AFFECT_POTION_4,     AFFECT_POTION_5,     AFFECT_POTION_6, #endif


char.h


ARAT


Kod:
void            FlushDelayedSaveItem();


EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION             bool            SetAffectPotion(LPITEM item); #endif


char_item.cpp


ARAT


Kod:
void CHARACTER::UseSilkBotary(void) {     if (m_bNoOpenedShop) {         DWORD dwPlayerID = GetPlayerID();         db_clientdesc->DBPacket(HEADER_GD_MYSHOP_PRICELIST_REQ, GetDesc()->GetHandle(), &dwPlayerID, sizeof(DWORD));         m_bNoOpenedShop = false;     } else {         __OpenPrivateShop();     } }


EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION bool CHARACTER::SetAffectPotion(LPITEM item) {     int blend_get_affect[*] = {AFFECT_POTION_1, AFFECT_POTION_2, AFFECT_POTION_3, AFFECT_POTION_4, AFFECT_POTION_5, AFFECT_POTION_6};          int blend_null[*] = {APPLY_NONE, AFF_NONE, 0, false};          int blend_list[*] = {50821, 50822, 50823, 50824, 50825, 50826};          const char* blend_succes = {"<Affect Potion> Set icon ingame for item: |cFFc9ff00|H|h[%s]"};          int    blend_time    = item->GetSocket(2);          switch (item->GetVnum())     {         case 50821:             AddAffect(blend_get_affect[0], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);                 break;         case 50822:             AddAffect(blend_get_affect[1], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);             break;         case 50823:             AddAffect(blend_get_affect[2], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);                 break;         case 50824:             AddAffect(blend_get_affect[3], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);                 break;             case 50825:             AddAffect(blend_get_affect[4], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);                 break;             case 50826:             AddAffect(blend_get_affect[5], blend_null[0], blend_null[2], blend_null[1], blend_time, blend_null[2], blend_null[3], blend_null[3]);                 break;         }             ChatPacket(CHAT_TYPE_INFO, blend_succes, item->GetName());     } #endif


ARAT


Kod:
AddAffect(affect_type, apply_type, apply_value, 0, apply_duration, 0, false);


USTUNE EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION                             SetAffectPotion(item);                         #endif


src/Server/game/src/char_affect.cpp


ARAT


Kod:
if (IsPC())             {                 SendAffectRemovePacket(GetDesc(), GetPlayerID(), pkAff->dwType, pkAff->bApplyOn);             }


USTUNE EKLE


Kod:
#ifdef ENABLE_NEW_AFFECT_POTION                         int pkAff_blend[*] = {AFFECT_POTION_1, AFFECT_POTION_2, AFFECT_POTION_3, AFFECT_POTION_4, AFFECT_POTION_5, AFFECT_POTION_6};                          if ((pkAff->dwType == pkAff_blend[0]) || (pkAff->dwType == pkAff_blend[1]) || (pkAff->dwType == pkAff_blend[2]) ||                 (pkAff->dwType == pkAff_blend[3]) || (pkAff->dwType == pkAff_blend[4]) || (pkAff->dwType == pkAff_blend[5]))             {                 ++it;                 continue;             } #endif




root/uiAffectShower.py


ARAT


Kod:
if type < 500:             return


SIL VE EKLE


Kod:
if app.ENABLE_NEW_AFFECT_POTION:             if type < 500 and not type == AFFECT_POTION["affect"][0] and not type == AFFECT_POTION["affect"][1] and not type == AFFECT_POTION["affect"][2] and not type == AFFECT_POTION["affect"][3] and not type == AFFECT_POTION["affect"][4] and not type == AFFECT_POTION["affect"][5]:                 return         else:             if type < 500:                 return


ARAT


Kod:
import math


EKLE


Kod:
if app.ENABLE_NEW_AFFECT_POTION:                     AFFECT_POTION = {         "affect"  : {             0 : 303,             1 : 304,             2 : 305,             3 : 306,             4 : 307,             5 : 308,         },         #"modulePython"  : {             #0 : str(pkAffect),             #1 : int(pRemove_vegas),         #},         "image"  : {             0 : "icon/item/50821.tga",             1 : "icon/item/50822.tga",             2 : "icon/item/50823.tga",             3 : "icon/item/50824.tga",             4 : "icon/item/50825.tga",             5 : "icon/item/50826.tga",         },     }


ARAT


Kod:
if app.ENABLE_DRAGON_SOUL_SYSTEM:         AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK1] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK1, "d:/ymir work/ui/dragonsoul/buff_ds_sky1.tga")         AFFECT_DATA_DICT[chr.NEW_AFFECT_DRAGON_SOUL_DECK2] = (localeInfo.TOOLTIP_DRAGON_SOUL_DECK2, "d:/ymir work/ui/dragonsoul/buff_ds_land1.tga")


EKLE


Kod:
if app.ENABLE_NEW_AFFECT_POTION:             AFFECT_DATA_DICT[AFFECT_POTION["affect"][0]] = (localeInfo.TOOLTIP_AFFECT_POTION_1, AFFECT_POTION["image"][0])         AFFECT_DATA_DICT[AFFECT_POTION["affect"][1]] = (localeInfo.TOOLTIP_AFFECT_POTION_2, AFFECT_POTION["image"][1])         AFFECT_DATA_DICT[AFFECT_POTION["affect"][2]] = (localeInfo.TOOLTIP_AFFECT_POTION_3, AFFECT_POTION["image"][2])         AFFECT_DATA_DICT[AFFECT_POTION["affect"][3]] = (localeInfo.TOOLTIP_AFFECT_POTION_4, AFFECT_POTION["image"][3])         AFFECT_DATA_DICT[AFFECT_POTION["affect"][4]] = (localeInfo.TOOLTIP_AFFECT_POTION_5, AFFECT_POTION["image"][4])         AFFECT_DATA_DICT[AFFECT_POTION["affect"][5]] = (localeInfo.TOOLTIP_AFFECT_POTION_6, AFFECT_POTION["image"][5])


locale/xx/locale_game.txt


EKLE


Kod:
TOOLTIP_AFFECT_POTION_1    Potion Red    SNA TOOLTIP_AFFECT_POTION_2    Potion Orange    SNA TOOLTIP_AFFECT_POTION_3    Potion Yellow    SNA TOOLTIP_AFFECT_POTION_4    Potion Green    SNA TOOLTIP_AFFECT_POTION_5    Potion Blue    SNA TOOLTIP_AFFECT_POTION_6    Potion White    SNA

[C ++] Gerçek Zamanlı item_blend Simgeleri

Metin2 özel sunucu geliştirme sürecinde, görsel efektler ve kullanıcı deneyimi üzerinde büyük etkisi olan unsurlardan biri de item_blend sistemidir. Bu sistem, oyuncuların eşya kullanımında veya animasyon sırasında gerçek zamanlı olarak ekrana yansıyan simgeler sayesinde daha zengin ve akıcı bir oyun hissi kazandırır. Bu yazıda, C++ tabanlı bir Metin2 sunucusunda nasıl gerçek zamanlı item_blend simgeleri entegre edileceği, hangi dosyalarda değişiklik yapılması gerektiği ve bu simgelerin kullanıcı arayüzüne nasıl yansıtılacağı detaylı şekilde ele alınacaktır.

item_blend Nedir?

item_blend, Metin2 oyununda belirli eşyaların kullanımı sırasında ekranın belirli bir bölgesine yansıyan animasyonlu veya statik görsellerdir. Bu efektler genellikle potion, buff item veya özel aksesuarlar gibi eşyalar kullanıldığında görünür. Kullanıcının dikkatini çekecek şekilde tasarlanan bu efektler, hem görsel açıdan hem de işlevsel olarak kullanıcıya bilgi verir.

Real-time item_blend Entegrasyonu

C++ tabanlı bir Metin2 sunucu yapısında gerçek zamanlı item_blend simgesi entegre etmek için öncelikle game core kısmında bazı değişiklikler yapılması gerekir. Özellikle client/src/game dizininde yer alan uitooltip.cpp ve uitooltip.h dosyalarında eşya simgesi yönetimiyle ilgili fonksiyonlar düzenlenmelidir.

item_blend Simgesi Yükleme ve Gösterme

Python GUI sistemine entegre edilen bu simge, uiscript üzerinden tanımlanır. Örneğin, bir potion item kullanıldığında ekranda belirli bir süre görünen animasyonlu bir simge göstermek istiyorsanız, bu simgenin py root klasöründe uygun formatta (.dds veya .tga) bulunması gerekir. Ayrıca pack içine de bu görselin eklenmiş olması gerekir ki istemci tarafında doğru şekilde yüklenip görüntülenebilsin.

Sunucu Tarafında item_blend Tanımı

Sunucu tarafında, eşyanın item_blend efekti için özel bir tanımlama yapılması gerekir. Bu tanımlamalar genellikle db core kısmında bulunan item_proto tablosuna eklenen özel alanlarla yapılır. Örneğin, 'item_blend_image' adında bir sütun oluşturulabilir ve bu sütuna her bir eşya için özel bir görsel atanabilir. Bu veri, eşya kullanıldığında sunucu tarafından istemciye gönderilir ve py gui sistemi tarafından render edilir.

Olay Tetikleme Mekanizması

Metin2 oyun motorunda bir eşya kullanıldığında tetiklenen event handler, bu item_blend simgesinin ekrana yansımasını sağlar. Bu mekanizma genellikle martysama veya diğer Metin2 geliştirici toplulukları tarafından geliştirilmiş olan özel event sistemleri üzerinden çalışır. Eşya kullanıldığında bir sinyal gönderilir ve bu sinyal üzerine ui script dosyası ilgili görseli yükler ve ekrana basar.

item_blend Efekt Süresi ve Animasyon Ayarları

Gerçek zamanlı item_blend efektlerinin süresi ve animasyon özellikleri, uiscript dosyasında tanımlanan python sınıfları üzerinden ayarlanabilir. Örneğin, bir efektin sadece 3 saniye görünmesi isteniyorsa, bir sayaç eklenerek bu süre kontrol edilebilir. Ayrıca efektin solma, dönme veya büyüme gibi animasyon efektleri de py root içinde tanımlanabilir.

Güvenlik ve Performans Açısından Dikkat Edilmesi Gerekenler

item_blend efektleri, çok sayıda kullanıcı tarafından aynı anda kullanıldığında sunucu ve istemci tarafında performans sorunlarına neden olabilir. Bu nedenle, bu efektlerin sadece gerekli durumlarda ve optimize edilmiş görsellerle kullanılması önemlidir. Ayrıca, bu sistemlerin kötüye kullanımını engellemek için auth ve game server programming katmanlarında kontroller yapılmalıdır.

Sonuç

Gerçek zamanlı item_blend simgeleri, Metin2 özel sunucularında kullanıcı deneyimini ciddi anlamda artıran önemli bir özelliktir. Doğru yapılandırıldığında, hem görsel açıdan etkileyici hem de işlevsel olarak faydalı bir sistem oluşturabilirsiniz. Bu yazıda bahsedilen adımları takip ederek, metin2dev süreçlerinizde bu sistemi başarıyla entegre edebilirsiniz.


[C++] Real-Time item_blend Icons

In the process of developing Metin2 private servers, one of the elements that significantly impacts visual effects and user experience is the item_blend system. This system provides a richer and smoother gaming feel by displaying icons on the screen in real-time during item usage or animations. In this article, we will detail how to integrate real-time item_blend icons into a C++ based Metin2 server, which files need modification, and how these icons are reflected in the user interface.

What is item_blend?

item_blend refers to animated or static images that appear in a specific area of the screen when certain items are used in the Metin2 game. These effects usually appear when items such as potions, buffs, or special accessories are used. Designed to catch the player's attention, these effects provide information both visually and functionally.

Real-time item_blend Integration

To integrate real-time item_blend icons into a C++ based Metin2 server structure, some modifications must first be made in the game core. Particularly in the client/src/game directory, functions related to item icon management in the uitooltip.cpp and uitooltip.h files should be adjusted.

Loading and Displaying item_blend Icons

These icons integrated into the Python GUI system are defined through uiscript. For example, if you want an animated icon to appear on the screen for a specific duration when a potion item is used, this image must be present in the correct format (.dds or .tga) within the py root folder. Additionally, this graphic must be added to the pack so it can be correctly loaded and displayed on the client side.

Server-Side Definition of item_blend

On the server side, a custom definition is required for the item_blend effect of an item. These definitions are typically done by adding special columns to the item_proto table in the db core. For example, a column named 'item_blend_image' can be created, where each item has a specific image assigned. When the item is used, this data is sent from the server to the client and rendered by the py gui system.

Event Triggering Mechanism

In the Metin2 game engine, the event handler triggered when an item is used causes the item_blend icon to be displayed on the screen. This mechanism typically operates via custom event systems developed by martysama or other Metin2 developer communities. When an item is used, a signal is sent, and upon receiving this signal, the ui script file loads and displays the relevant image.

Duration and Animation Settings for item_blend Effects

The duration and animation properties of real-time item_blend effects can be adjusted through python classes defined in the uiscript file. For instance, if an effect is intended to only appear for 3 seconds, a counter can be added to control this duration. Moreover, animation effects like fade-out, rotation, or scaling can also be defined inside py root.

Considerations Regarding Security and Performance

When many users simultaneously trigger item_blend effects, performance issues may arise on both the server and client sides. Therefore, it is important to use these effects only when necessary and with optimized graphics. Furthermore, checks should be implemented in the auth and game server programming layers to prevent misuse of these systems.

Conclusion

Real-time item_blend icons are an important feature that significantly enhances the user experience in Metin2 private servers. When properly configured, they can create a system that is both visually impressive and functionally beneficial. By following the steps outlined in this article, you can successfully integrate this system into your metin2dev processes.
 

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

Benzer konular

Geri
Üst Alt