(alıntıdır)
kodlarda sorun yaşanmaması için bu linkten indirip kodları alın:
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
virutotal:
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
root/uiinventory.py açılır ve aratılır.
Kod:
self.wndMoneySlot = self.GetChild("Money_Slot")
>>altına eklenir<<
Kod:
self.wndMds = self.GetChild("Mds") self.wndMdsSlot = self.GetChild("Mds_Slot")
aratılır
Kod:
def Destroy(self): self.ClearDictionary() .... .... self.wndMoney = 0 self.wndMoneySlot = 0
>>altına eklenir<<
Kod:
self.wndMds = 0 self.wndMdsSlot = 0
aratılır
Kod:
def RefreshStatus(self):
>>aşağıdaki ile değiştirilir.<<
Kod:
def RefreshStatus(self): money = player.GetElk() self.wndMoney.SetText(localeInfo.NumberToMoneyStri ng(money)) import constInfo self.wndMds.SetText(str(constInfo.mds) + " Md's")
en son eklediğimiz(yukardaki) kod bloğunun altınada aşağıdaki kod eklenır
Kod:
def OnUpdate(self): import constInfo self.wndMds.SetText(str(constInfo.mds) + " Md's")
kaydelip çıkılır.
root/game.py açılır.
aratılır
Kod:
def __ServerCommand_Build(self): serverCommandList={
altıne eklenir.
Kod:
#Coins envanter sistemi"Mds" : self.__Mds, #Coins envanter sistemi
game.py nin en altına aşağıdaki kod eklenir.
Kod:
def __Mds(self, coins): import constInfo constInfo.mds = int(coins)
root/constinfo.py açılır. ve eklenir.
Kod:
mds = 0
locale/tr/ui/inventorywindow.py açılır. ve aratılır
Kod:
{ "name":"Money_Slot", "type":"button", "x":-68, "y":28, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Money_Icon", "type":"image", "x":-21, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Money", "type" : "text", "x" : 5, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789", }, ), },
>>altına eklenir<< koordinatları kendinize göre ayarlamayı unutmayın.
Kod:
{ "name":"Mds_Slot", "type":"button", "x":-68, "y":48, "horizontal_align":"center", "vertical_align":"bottom", "default_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "over_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "down_image" : "d:/ymir work/ui/public/parameter_slot_05.sub", "children" : ( { "name":"Mds_Icon", "type":"image", "x":-21, "y":2, "image":"d:/ymir work/ui/game/windows/money_icon.sub", }, { "name" : "Mds", "type" : "text", "x" : 5, "y" : 3, "horizontal_align" : "right", "text_horizontal_align" : "right", "text" : "123456789 Md's", }, ), },
aşağıdaki questide serverinize ekleyin.
Kod:
quest mds begin state start begin when login begin loop_timer("carga_mds", 10) end when carga_mds.timer begin local coins = mysql_query("SELECT coins from account.account WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1] cmdchat("Mds "..coins) end end end
Envanterde Coins Miktarı Görünsün
Metin2 özel sunucularında kullanıcı deneyimini artırmak, oyuncuların daha fazla etkileşim kurmasını sağlamak açısından küçük ama etkili değişiklikler yapmak önemlidir. Bu değişikliklerden birisi de envanter ekranında oyuncunun sahip olduğu coin miktarının görüntülenmesidir. Bu işlem genellikle client-side olarak düzenlenir ve oyuncuya daha şeffaf bir ekonomi sunulmasını sağlar. Bu yazıda, Metin2 özel sunucu geliştirme sürecinde nasıl envanterde coins miktarı gösterileceği konusunu detaylıca ele alacağız.
Neden Envanterde Coin Miktarı Göstermeli?
Oyuncuların ekonomik durumuna dair bilgiye kolay erişimi, hem oyun içi işlemlerde hem de satın alma kararlarında onlara yardımcı olur. Özellikle PvP odaklı sistemlerde, oyuncuların hızlıca coin kontrolü yapabilmesi, item alım-satımı veya upgrade işlemleri sırasında zaman kazandırır. Bu nedenle, coin miktarının doğrudan envanterde görünmesi, kullanıcı dostu bir arayüz geliştirmeye katkı sağlar.
Uygulama Adımları
Bu işlem için genellikle uiscript dosyası üzerinde değişiklik yapılır. Python GUI yapısı üzerinden çalışan Metin2 client tarafında, envanter arayüzüne bir metin kutusu eklenerek coin miktarı görüntülenebilir.
Öncelikle, inventorywindow.py dosyasında gerekli import ve fonksiyon tanımlamaları yapılmalıdır. Oyuncunun coin miktarını alabilmek için genellikle bir player.GetElkPoint() gibi fonksiyonlar kullanılır. Bu değer daha sonra ekranda bir label ile gösterilir.
Görsel Tasarım ve Yerleşim
Eklenen coin miktarı metni, genellikle ekranın sol üst köşesinde ya da envanterin sağ alt köşesinde yer alır. Bu, oyuncunun gözünü yormadan görebileceği bir konumda olmalıdır. Örneğin:
Kod:
[BR][/BR]self.coinText = ui.TextLine()[BR][/BR]self.coinText.SetParent(self)[BR][/BR]self.coinText.SetPosition(10, 10)[BR][/BR]self.coinText.SetText('Coins: ' + str(player.GetElkPoint()))[BR][/BR]self.coinText.Show()
Bu yapı sayesinde, coin miktarı sürekli olarak güncellenir ve oyuncu her envanteri açtığında güncel coin miktarını görür.
Otomatik Güncelleme Fonksiyonu
Coin miktarının otomatik olarak yenilenmesi için bir OnUpdate metodu kullanılabilir. Bu sayede, oyuncu coin harcasa bile bilgi anlık olarak güncellenir. Bu işlem genellikle player sınıfı üzerinden dinamik olarak yapılır ve UI tarafında bir sayaç çalıştırılır.
Sunucu Tarafında Desteğin Sağlanması
Client tarafında yapılan değişikliklerin sağlıklı çalışması için auth server ve game server tarafında da uygun veri aktarımı yapılmalıdır. Özellikle coin bilgisi değiştiğinde, client'a bu bilginin hızlıca iletilmesi gerekir. Bu işlem genellikle network packet yapısıyla sağlanır.
Sonuç
Envanterde coin miktarı göstermek, Metin2 özel sunucularında kullanıcı memnuniyetini artırabilecek küçük ama etkili bir özelliktir. Client tarafında PyGUI ile yapılan bu tür değişiklikler, kullanıcı deneyimini ciddi anlamda artırabilir. Ayrıca bu işlem, geliştiricilere sunucu tarafında daha fazla entegrasyon imkanı sunarak genişletilebilir sistemlerin geliştirilmesine olanak tanır.
Show Coins Amount in Inventory
In Metin2 private servers, making small but effective changes can significantly enhance user experience and encourage more player engagement. One such change is displaying the amount of coins owned by the player directly in the inventory screen. This adjustment is typically made on the client-side and contributes to a more transparent economy for players. In this article, we will thoroughly discuss how to display the coins amount in the inventory during Metin2 private server development.
Why Show Coins Amount in Inventory?
Providing easy access to the player's economic status helps with in-game transactions and purchasing decisions. Especially in PvP-oriented systems, allowing players to quickly check their coin balance saves time during item trading or upgrading processes. Therefore, showing the coin amount directly in the inventory enhances the user-friendly design of the interface.
Implementation Steps
This process usually involves modifying the uiscript file. In the Metin2 client, which operates via the Python GUI structure, a textbox can be added into the inventory window to display the coin amount.
Firstly, necessary imports and function definitions must be added to the inventorywindow.py file. To retrieve the player's coin value, functions like player.GetElkPoint() are commonly used. The value is then displayed on the screen using a label.
Visual Design and Layout
The added coin amount text is usually placed in the top-left or bottom-right corner of the inventory window, ensuring it remains visible without straining the player's eyes. For example:
Kod:
[BR][/BR]self.coinText = ui.TextLine()[BR][/BR]self.coinText.SetParent(self)[BR][/BR]self.coinText.SetPosition(10, 10)[BR][/BR]self.coinText.SetText('Coins: ' + str(player.GetElkPoint()))[BR][/BR]self.coinText.Show()
With this setup, the coin amount updates continuously, allowing the player to see the latest value every time they open the inventory.
Auto-Update Function
To ensure the coin amount updates automatically, an OnUpdate method can be implemented. This way, even if the player spends coins, the information updates instantly. This process typically occurs dynamically through the player class and runs a counter on the UI side.
Server-Side Support
For the client-side changes to function properly, appropriate data transmission must also occur on the auth server and game server. Whenever the coin value changes, it must be quickly transmitted to the client. This is usually handled via the network packet structure.
Conclusion
Displaying the coin amount in the inventory is a simple yet effective feature that can improve user satisfaction in Metin2 private servers. Client-side modifications using PyGUI can significantly enhance user experience. Additionally, such implementations provide developers with more integration options, enabling the development of scalable systems.
