Oyun içi imsakiye & iftar/sahur alarmı

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
kN0ep2B.jpeg



Kod:
onPressKeyDict[app.DIK_F4]    = lambda : self.__PressQuickSlot(7)

Altına ekle:
Kod:
onPressKeyDict[app.DIK_F5]    = lambda : self.__OpenRamadanTimer()

---

Arat:
Kod:
def OnMouseMiddleButtonUp(self):         player.SetMouseMiddleButtonState(player.MBS_CLICK)

Altına ekle:
Kod:
def __OpenRamadanTimer(self):         if self.interface:             self.interface.ToggleRamadanTimerWindow()

---

Arat:
Kod:
self.interface.BUILD_OnUpdate()

Altına ekle:
Kod:
if self.interface.wndRamadanTimer:             self.interface.wndRamadanTimer.OnUpdateEx()

* interfaceModule.py

Arat:
Kod:
import localeInfo

Altına ekle:
Kod:
import uiramadantimer

---

Arat:
Kod:
self.wndGuildBuilding = None

Altına ekle:
Kod:
self.wndRamadanTimer = None

---

Arat:
Kod:
self.wndChatLog = wndChatLog

Altına ekle:

Kod:
self.wndRamadanTimer = uiramadantimer.RamadanTimerWindow()

---

Arat:
Kod:
if self.wndCube:             self.wndCube.Destroy()

Altına ekle:

Kod:
if self.wndRamadanTimer:             self.wndRamadanTimer.Destroy()

---

Arat:
Kod:
if self.wndExpandedTaskBar:             self.wndExpandedTaskBar.Hide()

Altına ekle:

Kod:
if self.wndRamadanTimer:             self.wndRamadanTimer.Hide()

---

Arat:
Kod:
def SucceedCubeWork(self, itemVnum, count):         self.wndCube.Clear()         if 0:             self.wndCubeResult.SetPosition(*self.wndCube.GetGlobalPosition())             self.wndCubeResult.SetCubeResultItem(itemVnum, count)             self.wndCubeResult.Open()             self.wndCubeResult.SetTop()

Altına ekle:

Kod:
def ToggleRamadanTimerWindow(self):         if self.wndRamadanTimer:             self.wndRamadanTimer.Toggle()

---

Arat:
Kod:
if self.wndExpandedTaskBar:             hideWindows += self.wndExpandedTaskBar,

Altına ekle:

Kod:
if self.wndRamadanTimer:             hideWindows += self.wndRamadanTimer,

---

Arat:
Kod:
def EmptyFunction(self):         pass

Altına ekle:

Kod:
def OpenRamadanTimer(self):         uiramadantimer.OpenRamadanTimer()

---

* ui.py

Arat:
Kod:
class ListBox2(ListBox):

Üstüne ekle:
Kod:
class ListBoxScroll(ListBox):     def __init__(self):         ListBox.__init__(self)                  self.scrollBar = ScrollBar()         self.scrollBar.SetParent(self)         self.scrollBar.SetScrollEvent(self.__OnScroll)         self.scrollBar.Hide()     def SetSize(self, width, height):         ListBox.SetSize(self, width - ScrollBar.SCROLLBAR_WIDTH, height)         Window.SetSize(self, width, height)                  self.scrollBar.SetPosition(width - ScrollBar.SCROLLBAR_WIDTH, 0)         self.scrollBar.SetScrollBarSize(height)     def ClearItem(self):         ListBox.ClearItem(self)         self.scrollBar.SetPos(0)     def _LocateItem(self):         ListBox._LocateItem(self)                  if self.showLineCount < len(self.itemList):             self.scrollBar.SetMiddleBarSize(float(self.GetViewItemCount())/self.GetItemCount())             self.scrollBar.Show()         else:             self.scrollBar.Hide()     def __OnScroll(self):         scrollLen = self.GetItemCount()-self.GetViewItemCount()         if scrollLen < 0:             scrollLen = 0         self.SetBasePos(int(self.scrollBar.GetPos()*scrollLen))

---

Arat:
Kod:
self.bCodePage = False

Altına ekle:
Kod:
self.max = 0         self.userMax = 0

---

uiramadantimer.py isminde dosya oluştur ve içine ekle:


---

* PythonApplicationModule.cpp

Arat:
Kod:
void initapp()

Üstüne ekle:
Kod:
#include <shellapi.h> #include <wininet.h> #pragma comment(lib, "wininet.lib") std::string httpGet(const std::string& url) {     auto hInternet = InternetOpenA("M2", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);     if (!hInternet)     {         TraceError("InternetOpenA failed with error %u", GetLastError());         return "-1";     }     auto hFile = InternetOpenUrlA(hInternet, url.c_str(), NULL, 0, INTERNET_FLAG_RELOAD, 0);     if (!hFile)     {         TraceError("InternetOpenUrlA failed with error %u", GetLastError());         InternetCloseHandle(hInternet);         return "-2";     }     std::string contents;     char buffer[4096];     DWORD bytesRead = 0;     while (InternetReadFile(hFile, buffer, sizeof(buffer), &bytesRead) && bytesRead > 0)         contents.append(buffer, bytesRead);     if (contents.empty())     {         TraceError("InternetReadFile failed with error %u", GetLastError());         contents = "-3";     }     InternetCloseHandle(hFile);     InternetCloseHandle(hInternet);     return contents; } PyObject* appHttpRequest(PyObject* poSelf, PyObject* poArgs) {     char* sUrl;     if (!PyTuple_GetString(poArgs, 0, &sUrl))         return Py_BuildException();     const auto result = httpGet(sUrl);     return PyBytes_FromStringAndSize(result.c_str(), result.length()); } PyObject* appShowTrayNotification(PyObject* poSelf, PyObject* poArgs) {     char* szTitle;     if (!PyTuple_GetString(poArgs, 0, &szTitle))         return Py_BuildException();     char* szMessage;     if (!PyTuple_GetString(poArgs, 1, &szMessage))         return Py_BuildException();     int nTimeout = 5000; // default 5 seconds     PyTuple_GetInteger(poArgs, 2, &nTimeout);     int nIconType = NIIF_INFO; // default icon type     PyTuple_GetInteger(poArgs, 3, &nIconType);     // Get application window handle     HWND hWnd = CPythonApplication::Instance().GetWindowHandle();     // Prepare notification data     NOTIFYICONDATA nid = {0};     nid.cbSize = sizeof(NOTIFYICONDATA);     nid.hWnd = hWnd;     nid.uID = 1; // ID for the icon, can be any value     nid.uFlags = NIF_INFO | NIF_ICON | NIF_MESSAGE;     nid.uCallbackMessage = WM_USER + 1;     nid.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_METIN2));     nid.uTimeout = nTimeout;     nid.dwInfoFlags = nIconType;          strncpy(nid.szInfoTitle, szTitle, sizeof(nid.szInfoTitle) - 1);     strncpy(nid.szInfo, szMessage, sizeof(nid.szInfo) - 1);     // Show notification     BOOL result = Shell_NotifyIcon(NIM_ADD, &nid);          // Remove the icon after showing the notification     nid.uFlags = 0;     Shell_NotifyIcon(NIM_DELETE, &nid);     return Py_BuildValue("i", result ? 1 : 0); } PyObject* appBeep(PyObject* poSelf, PyObject* poArgs) {     int frequency;     int duration;     if (!PyTuple_GetInteger(poArgs, 0, &frequency))         return Py_BuildException();     if (!PyTuple_GetInteger(poArgs, 1, &duration))         return Py_BuildException();     Beep(frequency, duration);     return Py_BuildNone(); }

---

Arat:
Kod:
{ "OnLogoClose",                appLogoClose,                    METH_VARARGS },

Altına ekle:
Kod:
{ "HttpRequest",                appHttpRequest,                    METH_VARARGS },         { "ShowTrayNotification",        appShowTrayNotification,        METH_VARARGS },         { "Beep",                        appBeep,                        METH_VARARGS },

---

Arat:
Kod:
#ifdef ENABLE_ENERGY_SYSTEM     PyModule_AddIntConstant(poModule, "ENABLE_ENERGY_SYSTEM",    1); #else     PyModule_AddIntConstant(poModule, "ENABLE_ENERGY_SYSTEM",    0); #endif

Altına ekle:
Kod:
// Tray notification icon types     PyModule_AddIntConstant(poModule, "NOTIFICATION_ICON_INFO", NIIF_INFO);     PyModule_AddIntConstant(poModule, "NOTIFICATION_ICON_WARNING", NIIF_WARNING);     PyModule_AddIntConstant(poModule, "NOTIFICATION_ICON_ERROR", NIIF_ERROR);     PyModule_AddIntConstant(poModule, "NOTIFICATION_ICON_NONE", NIIF_NONE);

Oyun İçinde Ramazan İmsakiyesi ve İftar/Sahur Alarmı Sistemi

Metin2 sunucularında özel etkinlikler ve oyun içi sistemler sunucu deneyimini ciddi anlamda artırabilir. Özellikle Ramazan gibi dini ve kültürel olarak önemli dönemlerde oyuncuların oyun içi aktiviteleriyle birlikte ibadetlerini de rahatça yapabilmeleri büyük önem taşır. Bu doğrultuda, oyun içi imsakiye ve iftar/sahur alarmı gibi sistemler hem kullanıcı dostu bir yapı sunar hem de topluluk odaklı bir atmosfer yaratır. Bu yazıda, Metin2 özel sunucularında nasıl bir imsakiye ve alarm sistemi kurulabileceği, hangi teknik adımların izleneceği ve bu sistemin C++ ve Python tabanlı sistemlerle nasıl entegre edilebileceği üzerinde duracağız.

Oyun İçinde İmsakiye Nedir?

Oyun içi imsakiye, oyuncuların sahip oldukları karakterler üzerinden Ramazan ayında imsak, iftar ve sahur gibi vakitleri takip edebilmelerini sağlayan bir sistemdir. Bu sistem sayesinde oyuncular, gerçek hayattaki ibadet zamanlarını unutmaksızın oyun içi görevlerini veya PvP savaşlarını da aksatmazlar. Özellikle gece saatlerinde aktif olan oyuncular için sahur vakti hatırlatıcısı büyük kolaylık sağlar. Aynı zamanda iftar vakti geldiğinde oyun içi etkinliklere özel bonuslar tanımlanabilir, bu da oyuncu etkileşimini artırır.

Alarm Sisteminin Teknik Altyapısı

Bu sistemin kurulabilmesi için game server tarafında bir zamanlayıcı (timer) sistemi oluşturulmalıdır. Bu işlem genellikle C++ dilinde yazılmış olan src dosyalarında yapılır. Zamanlayıcı, sunucu saatinin doğru şekilde ayarlanmasını gerektirir. Game core içerisinde bir zaman kontrol mekanizması geliştirilerek belirlenen saatlerde oyun içinde bir bildirim veya efekt çalıştırılabilir. Örneğin, iftar vakti geldiğinde tüm oyunculara 'İftar vakti gelmiştir, afiyet olsun!' mesajı gönderilebilir.

Ayrıca Python tabanlı sistemlerde, uiscript ile basit bir arayüz hazırlanarak oyuncuların kendi saat dilimlerini seçebilmeleri sağlanabilir. Böylece global bir sunucuda yaşayan farklı bölgelerden oyuncular kendi imsakiyelerine göre uyarılmaları sağlanabilir. Bu sistem, py root ve py gui kullanılarak daha kullanıcı dostu bir hale getirilebilir.

Sistem Entegrasyonu ve Güvenlik

Sistemin doğru çalışabilmesi için auth server ve game server senkronizasyonu çok önemlidir. Saat farkları nedeniyle yanlış zamanlarda tetiklenen alarm sistemleri kullanıcıyı yanıltabilir. Bu nedenle server src üzerinde GMT+3 gibi sabit zaman dilimi ayarlamaları yapılmalı ya da her oyuncu için dinamik saat dilimi desteği geliştirilmelidir. Ayrıca bu tür sistemlerin Martysama veya diğer source edit projeleriyle uyumlu olması da önemlidir.

Oyun İçinde Bonus ve Etkinlikler

Ramazan boyunca iftar vakti geldiğinde özel pack veya bonus sistemleri devreye sokulabilir. Bu sayede oyuncuların dikkati oyun içine yönlendirilir ve katılım oranı artar. Örneğin, iftar vaktinden sonra 1 saat boyunca %50 XP kazanımı gibi avantajlar sunulabilir. Bu tür sistemler, db core üzerinde zaman tabanlı event yönetimi ile kolayca entegre edilebilir. DB tarafında bir event tablosu oluşturularak zamanlanmış görevler tanımlanabilir.

Sonuç

Oyun içi imsakiye ve iftar/sahur alarmı sistemi, sadece teknik bir özellik değil aynı zamanda topluluk dostu bir uygulamadır. Metin2 özel sunucularında bu tür sistemlerin kurulması, oyuncuların oyun deneyimini zenginletmenin yanı sıra marka sadakatini de artırır. C++ ve Python tabanlı gelişmiş sistemlerle bu tür özelleştirmeler, core düzeyde yapılabileceği gibi client src üzerinden de entegre edilebilir. Metin2Lobby.com olarak bu tür sistemleri geliştirmek ve paylaşmak, topluluğun daha fazla faydalanmasını sağlar.


In-Game Imsakiye and Iftar/Suhur Alarm System

Special events and in-game systems can significantly enhance the experience on Metin2 servers. Especially during religious and cultural periods like Ramadan, allowing players to perform their worship alongside in-game activities is highly important. In this direction, systems like in-game imsakiye and iftar/suhur alarms provide a user-friendly structure while fostering a community-oriented atmosphere. In this article, we will discuss how such imsakiye and alarm systems can be set up on Metin2 private servers, the technical steps involved, and how they can be integrated with C++ and Python-based systems.

What is In-Game Imsakiye?

In-game imsakiye allows players to track prayer times such as dawn, iftar, and suhur through their characters during the Ramadan month. This system helps players avoid missing their worship times while continuing their in-game tasks or PvP battles. Particularly for players active during late-night hours, the suhur reminder provides great convenience. Additionally, special bonuses can be assigned to in-game events at iftar time, increasing player engagement.

Technical Infrastructure of the Alarm System

To implement this system, a timer mechanism must be created on the game server. This process is typically done within src files written in C++. The timer requires the server's time to be correctly configured. Within the game core, a time control mechanism can trigger notifications or effects at predetermined times. For instance, upon iftar time, all players can receive a message like 'Iftar time has arrived, enjoy your meal!'.

Additionally, in Python-based systems, a simple interface can be built using uiscript that allows players to select their own time zones. This ensures players from different regions on a global server are notified according to their local imsakiye times. This system can be made more user-friendly using py root and py gui.

System Integration and Security

For the system to function properly, synchronization between auth server and game server is crucial. Time differences could cause alarms to trigger at incorrect times, misleading users. Therefore, fixed timezone settings like GMT+3 should be applied on the server src, or dynamic timezone support should be developed per player. Compatibility with projects like Martysama or other source edits is also essential.

In-Game Bonuses and Events

During Ramadan, special pack or bonus systems can be activated after iftar time. This directs player attention into the game and increases participation. For example, a 50% XP bonus could be offered for one hour after iftar time. Such systems can easily be integrated via time-based event management on the db core. Scheduled tasks can be defined by creating an event table in the DB.

Conclusion

The in-game imsakiye and iftar/suhur alarm system is not just a technical feature but also a community-friendly application. Implementing such systems on Metin2 private servers enriches the gaming experience and increases brand loyalty. Such customizations can be implemented at the core level using advanced C++ and Python-based systems, or integrated through client src. At Metin2Lobby.com, developing and sharing such systems enables the community to benefit even further.
 

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

Geri
Üst Alt