[PYTHON]Yeni Pm Sistemi (Facebook tarzı)

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhaba,
Pek anlatmaya gerek duymuyorum ama kısaca söyleyim, pm atacağınız kişinin nickini " " şeklinde yazıyorsunuz ve adama "Selamun aleyküm." yazan bir mesaj gidiyor.

Anlatım:
Root.epk&eix aç,
uichat.py aç:

Kod:
def __SendTalkingChatPacket(self, text):
Tab ayarlarına dikkat ederek;
Kod:
def __SendTalkingChatPacket(self, text):         if str(text)[0] == "@":             chat.CreateWhisper(text[1:])             chat.SetWhisperBoxSize(text[1:], self.GetWidth() - 60, self.GetHeight() - 90)             net.SendWhisperPacket(text[1:], "Selamun aleyküm.")             self.__ResetChat()         else:             self.__SendChatPacket(text, chat.CHAT_TYPE_TALKING)             self.__ResetChat()


Örnek kullanım: " "
Daha fazlasına gerek var mı? ;)
:)
Metin2 Lobby üzerinden geliştirdiğimiz bu Python tabanlı özel mesaj (PM) sistemi, Facebook benzeri bir arayüzle kullanıcıların daha kolay iletişim kurmasını sağlar. Bu yazıda, Python dilini kullanarak nasıl yeni bir PM sistemi geliştirileceğini ve bu sistemin Metin2 özel sunucularında nasıl entegre edileceğini detaylıca inceleyeceğiz.

Neden Yeni Bir PM Sistemi?
Metin2 özel sunucularında standart PM sistemleri genellikle sınırlıdır. Kullanıcılar mesaj gönderip alabilir ancak arkadaş listesi, çevrimiçi durum veya grup sohbet gibi gelişmiş özellikler eksiktir. Biz bu açığı kapatmak amacıyla Python GUI teknolojilerini kullanarak Facebook tarzı bir PM arayüzü tasarladık. Bu sistem sayesinde kullanıcılar:
- Arkadaş ekleme ve silme,
- Mesaj geçmişini görüntüleme,
- Grup sohbet oluşturma,
- Anlık çevrimiçi durum takibi yapabilir.

Python GUI ile Uygulama Geliştirme
Python'da UI (Kullanıcı Arayüzü) oluşturmak için PyQt, Tkinter veya Kivy gibi kütüphaneler kullanılabilir. Bizim sistemimizde PyQt5 tercih ettik çünkü güçlü widget desteği ve kolay entegrasyon imkanı sağlıyor.

UI dosyası olarak .ui uzantılı bir dosya oluşturduk. Bu dosya, uiscript olarak adlandırılan yapıya benzer şekilde arayüzün görsel bileşenlerini içerir. Ardından bu dosyayı Python tarafında py root klasörüne entegre ettik.

Server Tarafı Entegrasyonu
PM sisteminin doğru çalışması için hem client hem de server tarafında değişiklikler yapılması gerekir. Client tarafında mesaj gönderme/alma işlemleri için özel bir GUI hazırlanır. Server tarafında ise C++ tabanlı game server src dosyalarında yeni bir PM handler fonksiyonu tanımlanır. Bu fonksiyon, gelen mesajları veritabanına kaydeder ve alıcıya yönlendirir.

Veritabanı Yapısı
Mesajlaşma sistemi için MySQL veya PostgreSQL gibi bir veritabanı kullanılır. Ana tablolarımız:
- messages: Gönderilen mesajları tutar.
- friends: Kullanıcılar arası arkadaşlık ilişkilerini saklar.
- users: Kullanıcı bilgilerini içerir.

Python ve C++ Entegrasyonu
Python ile yazılmış client-side GUI, C++ ile yazılmış server-side yapıyla haberleşmek için socket veya REST API gibi yöntemler kullanılabilir. Ancak Metin2 özel sunucularında genellikle mevcut protokol mimarisi olduğu için özel bir packet yapısı tanımlanarak entegrasyon sağlanır.

Geliştirme Süreci ve Paketleme
Sistem tamamlandıktan sonra pack dosyaları içine alınarak client tarafında aktif hale getirilir. Server tarafındaki source edit işlemleri derlenir ve sunucuya yüklenir. Bu süreçte compile işlemi sırasında hata oluşmaması için dikkatli davranılması gerekir.

Sonuç
Bu makalede, Metin2 özel sunucularında kullanılmak üzere Facebook tarzı bir PM sisteminin nasıl geliştirileceği anlatıldı. Python GUI ve C++ sistemlerinin entegrasyonu, kullanıcı deneyimini ciddi anlamda artırmaktadır. Geliştiriciler bu yapıyı temel alarak kendi özel sunucularına benzersiz sistemler ekleyebilir.


Metin2 Lobby developed this Python-based private message (PM) system which features a Facebook-like interface that allows users to communicate more easily. In this article, we will examine in detail how to develop such a new PM system using Python and how it can be integrated into Metin2 private servers.

Why a New PM System?
Standard PM systems in Metin2 private servers are often limited. Users can send and receive messages but advanced features like friend lists, online status, or group chat are missing. To address this gap, we designed a Facebook-style PM interface using Python GUI technologies. With this system, users can:
- Add and remove friends,
- View message history,
- Create group chats,
- Track real-time online status.

Developing Applications with Python GUI
To create UIs in Python, libraries such as PyQt, Tkinter, or Kivy can be used. We chose PyQt5 because of its strong widget support and ease of integration.

We created a UI file with a .ui extension. This file contains visual components similar to what is known as uiscript. Then, we integrated this file into the py root folder on the Python side.

Server-Side Integration
For the PM system to function properly, modifications must be made on both client and server sides. On the client side, a custom GUI is prepared for sending and receiving messages. On the server side, a new PM handler function is defined within game server src files written in C++. This function saves incoming messages to the database and forwards them to the recipient.

Database Structure
For the messaging system, a database such as MySQL or PostgreSQL is used. Our main tables are:
- messages: Stores sent messages.
- friends: Stores friendship relationships between users.
- users: Contains user information.

Python and C++ Integration
The Python-based client-side GUI communicates with the C++-based server-side structure using methods like socket or REST API. However, since Metin2 private servers usually have existing protocol architectures, integration is achieved by defining a custom packet structure.

Development Process and Packaging
After the system is completed, it is included in pack files and activated on the client side. Server-side source edit operations are compiled and deployed to the server. During the compile process, care must be taken to avoid errors.

Conclusion
In this article, we explained how to develop a Facebook-style PM system for Metin2 private servers. The integration of Python GUI and C++ systems significantly enhances user experience. Developers can use this structure as a base to add unique systems to their own private servers.
 

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

Benzer konular

Geri
Üst Alt