Önizleme
uiinventory.py:
Kod:
self.wndBeltInventoryLayer = None self.wndBeltInventorySlot = None self.expandBtn = None self.minBtn = None ##activateall self.UseItemBelt = None self.expandBtn = self.GetChild("ExpandBtn") self.minBtn = self.GetChild("MinimizeBtn") ##activateall self.UseItemBelt = self.GetChild("UseBeltItemsButton") self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory)) self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory)) ##activateall self.UseItemBelt.SetEvent(self.ActivateAll) self.wndBeltInventorySlot.RefreshSlot() ##activateall def ActivateAll(self): for i in xrange(item.BELT_INVENTORY_SLOT_COUNT): slotNumber = item.BELT_INVENTORY_SLOT_START + i net.SendItemUsePacket(slotNumber)
Beltinventorywindow.py:
Kod:
import uiScriptLocale import item EQUIPMENT_START_INDEX = 90 BUTTON_ROOT = "d:/ymir work/ui/public/" window = { "name" : "BeltInventoryWindow", ## 600 - (width + 오른쪽으로 부터 띄우기 24 px) "x" : SCREEN_WIDTH - 176 - 148, "y" : SCREEN_HEIGHT - 37 - 565 + 209 + 32, # "x" : -148, # "y" : 241, "width" : 148, "height" : 169, "type" : "image", "image" : "d:/ymir work/ui/game/belt_inventory/bg.tga", "children" : ( ## Expand Buttons { "name" : "ExpandBtn", "type" : "button", "x" : 2, "y" : 15, "default_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_normal.tga", "over_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_over.tga", "down_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_down.tga", "disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_expand_disabled.tga", }, ## Belt Inventory Layer (include minimize button) { "name" : "BeltInventoryLayer", # "type" : "board", # "style" : ("attach", "float"), "x" : 5, "y" : 0, "width" : 148, "height" : 169, "children" : ( ## Minimize Button { "name" : "MinimizeBtn", "type" : "button", "x" : 2, "y" : 15, "width" : 10, "default_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_normal.tga", "over_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_over.tga", "down_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_down.tga", "disable_image" : "d:/ymir work/ui/game/belt_inventory/btn_minimize_disabled.tga", }, ## Real Belt Inventory Board { "name" : "BeltInventoryBoard", "type" : "board", "style" : ("attach", "float"), "x" : 10, "y" : 0, "width" : 138, "height" : 169, "children" : ( ## Belt Inventory Slots { "name" : "BeltInventorySlot", "type" : "grid_table", "x" : 5, "y" : 5, "start_index" : item.BELT_INVENTORY_SLOT_START, "x_count" : 4, "y_count" : 4, "x_step" : 32, "y_step" : 32, "image" : "d:/ymir work/ui/public/Slot_Base.sub" }, ##activateall { "name" : "UseBeltItemsButton", "type" : "button", "x" : 0, "y" : 138, "horizontal_align" : "center", "default_image" : BUTTON_ROOT + "AcceptButton00.sub", "over_image" : BUTTON_ROOT + "AcceptButton01.sub", "down_image" : BUTTON_ROOT + "AcceptButton02.sub", }, ), }, ) }, ), }
Kemer Envanterindeki Tüm iksirleri Etkinleştirme
Metin2 özel sunucularında oyun deneyimini zenginleştirmek, oyuncuların daha verimli mücadele etmesini sağlamak adına bazı sistemsel ayarlamalar yapmak oldukça önemlidir. Bu sistemlerden birisi de oyuncuların kemer envanterinde barındırdığı iksirlerin hızlıca kullanılmasını sağlayacak olan otomatik kullanım sistemidir. Bu yazıda, Metin2 özel sunucularında kemerdeki tüm iksirleri tek seferde etkinleştirmenin yollarını detaylıca ele alacağız.
Kemer Sistemi Nedir?
Metin2 oyununda oyuncular, belirli sayıda iksir, para ve diğer hızlı erişim öğelerini bir kemer panelinde tutabilirler. Bu panel sayesinde savaş sırasında hızlıca iksir kullanmak mümkün olur. Ancak varsayılan sistemde sadece belirli slotlara yerleştirilen iksirler aktif edilebilir. Bu da bazı durumlarda oyuncuların eksik kalmasına neden olabilir.
Otomatik Etkinleştirme Sistemi
Bu sistemin temel amacı, oyuncunun kemerindeki tüm iksirlerin belirli bir tetikleyiciye göre otomatik olarak aktif edilmesini sağlamaktır. Bu tetikleyici genellikle belirli bir sağlık veya mana eşiğine düşülmesiyle olur. Örneğin, oyuncunun canı %30’un altına düştüğünde, kemerdeki tüm can iksirleri otomatik olarak tüketilir.
Sistem Kurulumu ve Kodlama
Bu sistemi kurabilmek için Python tabanlı PyRoot dosyalarında değişiklik yapmanız gerekir. Özellikle uiinventory.py ve uiscript.py gibi dosyalar üzerinde çalışarak kullanıcı arayüzünü düzenlemek önemlidir. Ayrıca C++ tabanlı Game Server Source tarafında da gerekli fonksiyonları yazarak sunucuyla haberleşmeyi sağlamanız gerekir.
Python Tarafında Kodlama
Py GUI kullanarak bir buton veya kısayol tuşu tanımlanabilir. Bu buton, oyuncunun basması halinde kemerdeki tüm iksirleri tarar ve kullanılır durumdaysa hepsini kullanır. Bu işlem sırasında sağlık ve mana miktarları kontrol edilir ve ekrana geri bildirim verilir. Örnek bir fonksiyon şu şekilde olabilir:
def activate_all_potions(self):
for slot_index in range(ITEM_SLOT_COUNT):
item = player.GetItemData(slot_index)
if self.is_potion(item):
net.SendItemUsePacket(slot_index)
Sunucu Tarafında Tetikleme
C++[/CODE] tarafında, char_item.cpp veya benzeri dosyalarda iksir kullanımı kontrol edilir. Oyuncu tarafından gönderilen paket karşılanır ve iksir türüne göre can, mana ya da başka bir stat güncellenir. Bu işlem sırasında güvenlik kontrolleri de yapılmalıdır. Aksi takdirde hile riski doğabilir.
Kullanıcı Deneyimi ve Avantajlar
Bu sistem sayesinde oyuncular, özellikle PvP savaşlarında daha hızlı ve etkili bir şekilde iksir kullanabilirler. Bu da kazanma şanslarını ciddi anlamda artırır. Ayrıca, yeni başlayan oyuncuların sistemle kolayca tanışması için bir kolaylık sağlar.
Sonuç
Metin2 özel sunucularında Metin2Lobby gibi platformlarda geliştirilen sistemler, oyunun rekabetçiliğini ve eğlenceli yönünü artırır. Kemerdeki tüm iksirleri etkinleştirme sistemi gibi küçük ama etkili değişiklikler, oyuncu memnuniyetini olumlu yönde etkiler. Geliştiricilerin dikkat etmesi gereken konulardan biri de hem DB hem de Game Core düzeyinde güvenli kodlama yapmaktır.
Activating All Potions in Belt Inventory
In order to enhance the gaming experience on Metin2 private servers and enable players to fight more effectively, certain systematic adjustments are quite important. One of these systems is the automatic usage system that allows quick use of potions stored in the player's belt inventory. In this article, we will detail how to activate all potions in the belt in Metin2 private servers.
What is the Belt System?
In Metin2, players can store a specific number of potions, gold, and other quick-access items in a belt panel. This panel allows players to quickly consume potions during combat. However, by default, only potions placed in specific slots can be activated. This can sometimes cause players to fall short in critical moments.
Automatic Activation System
The main purpose of this system is to automatically activate all potions located in the player’s belt upon a certain trigger. This trigger is generally based on dropping below a specific health or mana threshold. For example, when a player's HP drops below 30%, all health potions in the belt are automatically consumed.
System Installation and Coding
To install this system, modifications must be made to the Python-based PyRoot files. Particularly, files such as uiinventory.py and uiscript.py need to be edited to adjust the user interface. Additionally, necessary functions must be written on the C++-based Game Server Source side to communicate with the server.
Coding on the Python Side
Using Py GUI, a button or shortcut key can be defined. When pressed, this button scans all potions in the belt and consumes them if they are usable. During this process, health and mana values are checked, and feedback is provided on screen. An example function might look like this:
def activate_all_potions(self):
for slot_index in range(ITEM_SLOT_COUNT):
item = player.GetItemData(slot_index)
if self.is_potion(item):
net.SendItemUsePacket(slot_index)
Triggering on the Server Side
On the C++[/CODE] side, potion usage is controlled in files such as char_item.cpp. The packet sent by the player is received, and depending on the type of potion, health, mana, or another stat is updated. Security checks should also be performed at this stage; otherwise, cheating risks may arise.
User Experience and Advantages
Thanks to this system, players can use potions faster and more efficiently, especially in PvP battles. This significantly increases their chances of winning. Moreover, it provides an easy way for new players to interact with the system.
Conclusion
Systems developed on platforms like Metin2Lobby for Metin2 private servers increase both competitiveness and entertainment value of the game. Small but effective changes like activating all potions in the belt improve player satisfaction. Developers must pay attention to secure coding practices on both DB and Game Core levels.
