Envanter görüntüleme aç/kapat oyun seçeneklerine[c++,python,lua]

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Gamesrc/char.cpp arat
Kod:
void CHARACTER::SetBlockMode(BYTE bFlag)
kod bloğunu değiş;
Kod:
void CHARACTER::SetBlockMode(BYTE bFlag)[/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana] [CENTER]{ m_pointsInstant.bBlockMode = bFlag; ChatPacket(CHAT_TYPE_COMMAND, "setblockmode %d", m_pointsInstant.bBlockMode); SetQuestFlag("game_option.block_exchange", bFlag & BLOCK_EXCHANGE ? 1 : 0); SetQuestFlag("game_option.block_party_invite", bFlag & BLOCK_PARTY_INVITE ? 1 : 0); SetQuestFlag("game_option.block_guild_invite", bFlag & BLOCK_GUILD_INVITE ? 1 : 0); SetQuestFlag("game_option.block_whisper", bFlag & BLOCK_WHISPER ? 1 : 0); SetQuestFlag("game_option.block_messenger_invite", bFlag & BLOCK_MESSENGER_INVITE ? 1 : 0); SetQuestFlag("game_option.block_party_request", bFlag & BLOCK_PARTY_REQUEST ? 1 : 0); SetQuestFlag("game_option.block_view_equipment", bFlag & BLOCK_VIEW_EQUIPMENT ? 1 : 0); }

char.h arat
Kod:
enum EBlockAction
full değişin
Kod:
enum EBlockAction[/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana] [CENTER]{ BLOCK_EXCHANGE = (1 << 0), BLOCK_PARTY_INVITE = (1 << 1), BLOCK_GUILD_INVITE = (1 << 2), BLOCK_WHISPER = (1 << 3), BLOCK_MESSENGER_INVITE = (1 << 4), BLOCK_PARTY_REQUEST = (1 << 5), BLOCK_VIEW_EQUIPMENT = (1 << 6), };

cmd_general.cpp arat
Kod:
ACMD(do_view_equip)
altında biryerde bu kod olacak
Kod:
if (!tch->IsPC())
Kod:
[/B][/COLOR][/CENTER] [COLOR=#BB0000][B] [CENTER][COLOR=#BB0000][FONT=Verdana]return;[/FONT][/COLOR]

bunu ekleyin altına
Kod:
if (tch->IsBlockMode(BLOCK_VIEW_EQUIPMENT)) [/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana] [CENTER]{ ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ekipman konusmasi")); return; }

ayrıca orda
Kod:
if (ch->GetGMLevel() <= GM_PLAYER)[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]return;

böyle bir kod varsa silin çünkü sadece gm oyuncuların ekipmanlarına bakması için yapılmış bir engelleme
Game src bitti.
Clientsrc/packet.h arat
Kod:
enum EBlockAction
full değiş;
Kod:
enum EBlockAction[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]{ BLOCK_EXCHANGE = (1 << 0), BLOCK_PARTY_INVITE = (1 << 1), BLOCK_GUILD_INVITE = (1 << 2), BLOCK_WHISPER = (1 << 3), BLOCK_MESSENGER_INVITE = (1 << 4), BLOCK_PARTY_REQUEST = (1 << 5), BLOCK_VIEW_EQUIPMENT = (1 << 6), };

PythonPlayerModule.cpp arat
Kod:
// Block Mode
kodları değişin
Kod:
PyModule_AddIntConstant(poModule, "BLOCK_EXCHANGE", BLOCK_EXCHANGE);[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]PyModule_AddIntConstant(poModule, "BLOCK_PARTY", BLOCK_PARTY_INVITE); PyModule_AddIntConstant(poModule, "BLOCK_GUILD", BLOCK_GUILD_INVITE); PyModule_AddIntConstant(poModule, "BLOCK_WHISPER", BLOCK_WHISPER); PyModule_AddIntConstant(poModule, "BLOCK_FRIEND", BLOCK_MESSENGER_INVITE); PyModule_AddIntConstant(poModule, "BLOCK_PARTY_REQUEST", BLOCK_PARTY_REQUEST); PyModule_AddIntConstant(poModule, "BLOCK_VIEW_EQUIPMENT", BLOCK_VIEW_EQUIPMENT);

Sevmediğim bölüm pythona geçtik ^^
root/uitarget.py aratın
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_EXIT_OBSERVER].SAFE_SetEvent(self.__OnExitObserver)
Altına ekle:
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT].SAFE_SetEvent(self.__OnViewEquipment)
uitargetin ilk başındaki
Kod:
BUTTON_NAME_LIST = (
Aralarına ekleyin;
Kod:
localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT,
Aratın:
Kod:
def __OnExitObserver(self):[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]net.SendChatPacket("/observer_exit")

Altına ekleyin;
Kod:
def __OnViewEquipment(self):[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]net.SendChatPacket("/view_equip " + str(self.vid))

Arat:
Kod:
def ShowDefaultButton(self):
Full değiş;
Kod:
def ShowDefaultButton(self):[/B][/COLOR][/FONT][/COLOR][/CENTER] [COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER] self.isShowButton = TRUE self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_WHISPER]) self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE]) self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT]) self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT]) self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EMOTION_ALLOW]) for button in self.showingButtonList: button.Show()

root/uioption.py aratın:
Kod:
self.blockButtonList[4].SetToggleUpEvent(self.__OnClickBlockFriendButton)
Altına ekleyin;
Kod:
self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockViewEquipmentButton)
Kod:
self.blockButtonList[4].SetToggleDownEvent(self.__OnClickBlockFriendButton)
Kod:
self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockViewEquipmentButton)
Kod:
self.blockButtonList.append(GetObject("block_friend_button"))
Altına ekleyin:
Kod:
self.blockButtonList.append(GetObject("block_view_ equipment_button"))
Aratın:
Kod:
[/B][/COLOR]def __OnClickBlockPartyButton(self):[B]
Altına Ekleyin;
Kod:
[/B]def __OnClickBlockViewEquipmentButton(self):[/B][/COLOR][/CENTER] [COLOR=#0000cd][B] [CENTER]        self.RefreshBlock()         global blockMode         net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_VIEW_EQUIPMENT))[B]


root/uigameoption.py aratın
Kod:
def __OnClickBlockPartyButton(self):[/B][/COLOR][/FONT][/COLOR][/COLOR][/CENTER] [COLOR=#0000cd][COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]self.RefreshBlock() global blockMode net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_PARTY))

Altına ekleyin;
Kod:
def __OnClickBlockViewEquipmentButton(self):[/B][/COLOR][/FONT][/COLOR][/COLOR][/CENTER] [COLOR=#0000cd][COLOR=#BB0000][FONT=Verdana][COLOR=#0000cd][B] [CENTER]self.RefreshBlock() global blockMode net.SendChatPacket("/setblockmode " + str(blockMode ^ player.BLOCK_VIEW_EQUIPMENT))

Aratın:
Kod:
self.blockButtonList[5].SetToggleUpEvent(self.__OnClickBlockPartyRequest)
Altına ekleyin;
Kod:
self.blockButtonList[6].SetToggleUpEvent(self.__OnClickBlockViewEquipment Button)
Tekrar aratın:
Kod:
self.blockButtonList[5].SetToggleDownEvent(self.__OnClickBlockPartyReques t)
Altına ekleyin;
Kod:
self.blockButtonList[6].SetToggleDownEvent(self.__OnClickBlockViewEquipme ntButton)
Aratın:
Kod:
self.blockButtonList.append(GetObject("block_party _request_button"))
Altına ekleyin;
Kod:
self.blockButtonList.append(GetObject("block_view_ equipment_button"))
ve root bölümüde bitti
uiscript/gameoptiondialog.py arat:
Kod:
"name" : "block_party_request_button",
Altına ekleyin not kodların aralarını x y ayarıyla düzenlemeniz gerek çünkü iç içe girerler her butonun mesefasi 25 dir;
Kod:
{ "name" : "block_view_equipment_button",[/FONT][/COLOR][/COLOR][/CENTER] [COLOR=#0000cd][COLOR=#BB0000][FONT=Verdana] [CENTER]"type" : "toggle_button", "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH*0, "y" : 165, "text" : "Profil", "default_image" : ROOT_PATH + "middle_button_01.sub", "over_image" : ROOT_PATH + "middle_button_02.sub", "down_image" : ROOT_PATH + "middle_button_03.sub", },

Evet şimdi c++ ve python kısmı bitti
game_option.queste girin
Aralarına biryerine ekleyin;
Kod:
if pc.getqf("block_view_equipment") == 1 then[/FONT][/COLOR][/COLOR][/CENTER] [COLOR=#0000cd][COLOR=#BB0000][FONT=Verdana] [CENTER]msg = msg.."Profil " val = val + 6 end

Locale_stringe ekleyin;
Kod:
"ekipman konusmasi";[/FONT][/COLOR][/COLOR][/CENTER] [COLOR=#0000cd][COLOR=#BB0000][FONT=Verdana] [CENTER]"|cffFFC125Karşınızdaki oyuncu profil görüntülemeyi blokladı.";

Kanıtlar:
A0Jf8iW.jpg

Rl65qpN.jpg

Envanter Görüntüleme Aç/Kapat Oyun Seçenekleri Nedir?
Metin2 özel sunucularında kullanıcı deneyimini artırmak adına birçok görsel ve fonksiyonel ayar geliştiriciler tarafından yapılabiliyor. Bunlardan birisi de envanter penceresinin açılıp kapanmasını kontrol eden oyun seçeneğidir. Bu özellik, oyuncuların istedikleri zaman envanteri açıp kapatabilmelerini sağlar ve aynı zamanda bazı durumlarda performans avantajı da sağlayabilir.

C++ Tarafında Uygulama
Metin2 server-side geliştirme süreçlerinde C++ dili, özellikle oyun motoru ve core kısmında yoğun olarak tercih edilir. Envanter görünümünü kontrol eden sistem, client-side (istemci tarafında) çalışır. Ancak bu sistemle entegre çalışan sunucu taraflı sistemler, belirli durumlarda envanterin kullanımını sınırlamak veya otomatik olarak kapatmak gibi işlemleri yapabilir. Örneğin PvP savaşları sırasında envanterin kapatılması güvenlik açısından önemlidir. Bu işlem, C++ ile yazılmış özel sistemlerle sağlanabilir. Geliştiriciler, oyun içinde belirli durumlarda envanterin erişilemez kılınmasını sağlayacak event handler'lar yazabilirler.

Python ve UI Script Entegrasyonu
Metin2 client-side geliştirmelerinde Python diline dayalı UI script yapıları kullanılır. 'root' dosyası altında bulunan Python dosyaları, arayüz kontrollerinden sorumludur. Envanter penceresi genellikle 'uiscript' adı verilen Python tabanlı arayüz şablonları üzerinden yönetilir. Burada bir toggle (aç/kapat) mekanizması oluşturulabilir. Kullanıcı klavyeden belirli bir tuşa bastığında, envanterin görünür olup olmaması kontrol edilir ve buna göre pencere gösterilir veya gizlenir. Bu işlem genellikle 'wndMgr' veya benzeri UI manager sınıfları üzerinden yapılır.

Lua ile Dinamik Kontrol[/COLR]
Metin2'nin bazı özel sunucularında Lua scripting desteği de eklenebilir. Lua, daha hızlı prototipleme ve dinamik değişiklikler için idealdir. Eğer sunucunuzda Lua destekli bir sistem varsa, envanterin görünürlüğü Lua komutları ile de kontrol edilebilir. Özellikle GUI elementlerinin runtime'da değiştirilmesi gibi işlemlerde Lua avantaj sağlar. Geliştiriciler, belirli animasyonlar veya efektlerle birlikte envanterin açılıp kapanmasını sağlayabilirler.

Güvenlik ve Performans Açısından Dikkat Edilmesi Gerekenler
Oyun içi envanter gibi sistemler, doğru şekilde yönetilmezse hem güvenlik açıklarına neden olabilir hem de performans kayıplarına yol açabilir. Özellikle PvP sistemlerinde, oyuncuların savaş esnasında envanteri kullanarak item değiştirmesi oyun dengesini bozabilir. Bu yüzden C++ tabanlı sunucu taraflı kontrollerle birlikte Python UI script'lerinde de sınırlamalar getirilmelidir. Ayrıca, envanterin ani açılması/kapanması gibi animasyonlar, düşük donanımlı sistemlerde frame drop'a sebep olabilir. Bu nedenle optimize edilmiş toggle fonksiyonları yazmak önemlidir.

Sonuç
Envanter görüntüleme aç/kapat sistemi, Metin2 özel sunucularında kullanıcı dostu bir deneyim yaratmak için önemli bir özelliktir. C++, Python ve Lua gibi diller farklı katmanlarda bu sistemin işleyişini sağlar. Doğru entegrasyon ile kullanıcılar daha akıcı ve kontrollü bir oyun deneyimi yaşar. Geliştiricilerin bu sistemleri güvenli ve performanslı şekilde uygulaması, sunucunun genel kalitesini artırır.


What Are Inventory Toggle Game Options?
In Metin2 private servers, many visual and functional settings can be adjusted by developers to enhance the user experience. One of these features is the game option that controls the opening and closing of the inventory window. This feature allows players to open or close the inventory at will and may also provide performance benefits in certain situations.

Implementation in C++
In Metin2 server-side development processes, the C++ language is commonly used, especially for the game engine and core parts. The inventory visibility control system operates on the client-side. However, server-side systems integrated with this system can restrict the use of the inventory or automatically close it under specific conditions. For instance, closing the inventory during PvP battles is important for security reasons. This process can be achieved through custom systems written in C++. Developers can write event handlers that make the inventory inaccessible under certain in-game conditions.

Python and UI Script Integration
In Metin2 client-side development, UI script structures based on the Python language are used. The Python files located under the 'root' folder are responsible for interface controls. The inventory window is typically managed through UI templates called 'uiscript', which are Python-based. Here, a toggle mechanism can be created so that when the user presses a specific key on the keyboard, the visibility of the inventory is checked, and the window is shown or hidden accordingly. This operation is usually handled via UI manager classes like 'wndMgr'.

Dynamic Control with Lua
In some private Metin2 servers, Lua scripting support can also be added. Lua is ideal for faster prototyping and dynamic modifications. If your server has a Lua-supported system, the visibility of the inventory can also be controlled through Lua commands. Particularly for changing GUI elements at runtime, Lua provides advantages. Developers can enable the inventory to open or close with specific animations or effects.

Considerations for Security and Performance
If systems like the in-game inventory are not properly managed, they can cause both security vulnerabilities and performance losses. Especially in PvP systems, allowing players to change items through the inventory during combat can disrupt game balance. Therefore, along with C++ server-side controls, restrictions should also be implemented in Python UI scripts. Additionally, sudden opening/closing animations of the inventory might cause frame drops on low-end systems. Hence, writing optimized toggle functions is important.

Conclusion
The inventory toggle system is an important feature for creating a user-friendly experience in Metin2 private servers. Languages such as C++, Python, and Lua enable the functioning of this system across different layers. With proper integration, users experience a smoother and more controlled gameplay. When developers implement these systems securely and efficiently, the overall quality of the server increases.
 

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

Geri
Üst Alt