Sohbet Pençeresinde saat ve seviye gösterme

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
root/uiwhisper.py açılır ve aratılır;
Kod:
def SendWhisper(self):
Tamamı değiştirilir:
Renkli Yapmak İsteyenler:
Kod:
def SendWhisper(self):         import time         import player         text = self.chatLine.GetText()         textLength = len(text)         if textLength > 0:             if net.IsInsultIn(text):                 chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)                 return             VectorsSaat = time.strftime("%H:%M:%S")             net.SendWhisperPacket(self.targetName, "|cffADFF2F[Saat" + RiopotioNSaat + "|cFF00FFFF|h[Lv" + str(player.GetStatus(player.LEVEL)) + "]|cffffcc00: " + text)             self.chatLine.SetText("")             chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + "|cffADFF2F[Saat" + RiopotioNSaat + "|cFF00FFFF|h[Lv" + str(player.GetStatus(player.LEVEL)) + "]|cffffcc00: " + text)             #turkmmo.com riopotion

Renksiz yapmak istiyenler
Kod:
def SendWhisper(self):         import time         import player         text = self.chatLine.GetText()         textLength = len(text)         if textLength > 0:             if net.IsInsultIn(text):                 chat.AppendChat(chat.CHAT_TYPE_INFO, locale.CHAT_INSULT_STRING)                 return             VectorsSaat = time.strftime("%H:%M:%S")             net.SendWhisperPacket(self.targetName, "[Saat" + RiopotioNSaat + "[Lv" + str(player.GetStatus(player.LEVEL)) + "]: " + text)             self.chatLine.SetText("")             chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + "[Saat" + RiopotioNSaat + "[Lv" + str(player.GetStatus(player.LEVEL)) + "]: " + text)         #turkmmo.com riopotion

Renk Kodları

Sohbet Pençeresinde Saat ve Seviye Gösterme: Metin2 Özel Sunucular İçin Gelişmiş Özellik

Metin2 özel sunucularında kullanıcı deneyimini artırmak adına birçok küçük ama etkileyici sistem eklenebilir. Bunlardan birisi sohbet penceresinde saat ve oyuncu seviyesi gibi bilgileri göstermektir. Bu sistem, oyuncuların hem zamanı takip edebilmesini sağlar hem de sohbet sırasında kimin hangi seviyede olduğunu kolayca gözlemlemelerine olanak tanır. Bu yazıda, Metin2 özel sunucularında sohbet penceresine saat ve seviye bilgilerinin nasıl ekleneceğini adım adım anlatacağız.

Saat Bilgisinin Eklenmesi

Sohbet penceresinde saat bilgisini göstermek için öncelikle istemci tarafında (client side) değişiklik yapmanız gerekir. Uiscript veya Python GUI dosyalarında yer alan chat.py dosyası üzerinde çalışılır. ChatWindow sınıfı içerisinde mesajların yazıldığı alana saat bilgisini eklemek için bir fonksiyon tanımlamalısınız. Örneğin:

def AddText(self, text, name, number):
currentTime = time.strftime('%H:%M')
formattedText = f'[{currentTime}] {text}'
self.chatLine.AppendText(formattedText)

Bu şekilde her mesajın başına saat bilgisi eklenmiş olur. Tabii ki bu işlem sırasında time modülünün import edildiğinden emin olmalısınız.

Seviye Bilgisinin Eklenmesi

Sohbette seviye bilgisi göstermek ise daha çok sunucu tarafında yapılan bir veri aktarımı gerektirir. Oyuncu sohbete mesaj attığında, bu mesajla birlikte o oyuncunun seviyesi de gönderilir. Bu işlem için game server üzerinde bir değişiklik yapılması gerekir. Özellikle C++ tabanlı bir server src üzerinde çalışıyorsanız, mesaj gönderme protokolüne level bilgisini de eklemelisiniz.

Örneğin, mesaj gönderme fonksiyonuna level parametresi ekleyebilirsiniz:

void ChatPacketProcess(LPCHARACTER ch, const char* msg, int level)
{
// Level bilgisi mesajla birlikte istemciye gönderilir
}

İstemcide bu level bilgisi alındığında, mesajın yanına eklenebilir:

formattedMessage = f'{name} [Lv.{level}] {message}'

Python GUI ve Py Root Entegrasyonu

Eğer GUI tarafında Python kullanıyorsanız, py root ve py gui yapıları üzerinden bu işlemleri daha kolay halledebilirsiniz. Özellikle martysama gibi popüler kaynaklar üzerinden örneklerle desteklenebilirsiniz. Chat sistemine entegre edilecek bu küçük değişiklikler, kullanıcıların deneyimini ciddi anlamda artırabilir.

Teknik Zorluk ve Performans Etkisi

Bu tarz sistemlerin uygulanması sırasında dikkat edilmesi gereken bazı teknik konular vardır. Her mesajda seviye ve saat bilgisi gönderilmesi, network trafiğini bir miktar artırabilir. Ancak bu artış genellikle ihmal edilebilir düzeydedir. Yine de sunucu performansını etkileyebilecek tüm eklemelerde dikkatli olunmalıdır. Özellikle PvP sunucularda her milisaniye önemlidir.

Sonuç

Sohbet penceresinde saat ve seviye gösterimi, kullanıcı dostu bir sistemdir ve Metin2 özel sunucularında kolayca entegre edilebilir. Bu özellik, hem sunucunun profesyonelliğini artırır hem de oyuncuların oyun içinde daha bilinçli hareket etmelerini sağlar. Geliştiriciler, client src, server src, uiscript ve diğer kaynakları kullanarak bu sistemi kendi sunucularına uyarlayabilirler.


Displaying Time and Level in Chat Window: An Advanced Feature for Metin2 Private Servers

In Metin2 private servers, various small but impactful systems can be added to enhance the user experience. One such feature is displaying time and player level information directly in the chat window. This system allows players to keep track of time easily and observe each other's levels while chatting. In this article, we will explain step by step how to add time and level information to the chat window in Metin2 private servers.

Adding Time Information

To display time in the chat window, you need to make modifications on the client side. You'll work with the chat.py file located in the Uiscript or Python GUI files. Inside the ChatWindow class, where messages are displayed, define a function that adds the current time to each message. For example:

def AddText(self, text, name, number):
currentTime = time.strftime('%H:%M')
formattedText = f'[{currentTime}] {text}'
self.chatLine.AppendText(formattedText)

With this approach, each message will now begin with the current time. Ensure that the time module is imported before proceeding.

Adding Level Information

Displaying level information in chat requires more work on the server side. When a player sends a message in chat, their level must also be sent along with the message. This involves modifying the game server. If working with a C++-based server src, you'll need to add level data to the message-sending protocol.

For instance, you can modify the chat packet processing function to include level data:

void ChatPacketProcess(LPCHARACTER ch, const char* msg, int level)
{
// Send level data alongside the message to the client
}

On the client side, the level data can be appended to the message like this:

formattedMessage = f'{name} [Lv.{level}] {message}'

Python GUI and Py Root Integration

If you're using Python for your GUI, structures like py root and py gui can simplify these implementations. Popular resources like martysama offer examples that can support such customizations. These minor additions to the chat system can significantly improve the overall user experience.

Technical Challenges and Performance Impact

When implementing features like these, several technical considerations should be kept in mind. Sending time and level information with every message may slightly increase network traffic. However, this increase is generally negligible. Still, all additions that could impact server performance should be approached carefully, especially on PvP servers where every millisecond counts.

Conclusion

Displaying time and level in the chat window is a user-friendly feature that can be easily integrated into Metin2 private servers. This enhancement boosts the professionalism of the server and helps players act more consciously within the game. Developers can use client src, server src, uiscript, and other resources to adapt this system to their own servers.
 

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

Benzer konular

Geri
Üst Alt