Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
İsteyenler vardı, kodladığım halini boş anımda paylaşacağımı söylemiştim.
Videodaki gibidir.
Tab ayarları vs. için
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
tüm halini alırsınız.(linki görmeyenler (!) için:
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
)PythonSystemModule.cpp aç içinde ara:
Kod:
PyObject * systemSetShowDamageFlag(PyObject * poSelf, PyObject * poArgs)
Üstüne ekle:
Kod:
PyObject * systemSetShowTargetDamageFlag(PyObject * poSelf, PyObject * poArgs) { int iFlag; if (!PyTuple_GetInteger(poArgs, 0, &iFlag)) return Py_BuildException(); CPythonSystem::Instance().SetShowTargetDamageFlag( iFlag); return Py_BuildNone(); } PyObject * systemIsShowTargetDamage(PyObject * poSelf, PyObject * poArgs) { return Py_BuildValue("i", CPythonSystem::Instance().IsShowTargetDamage()); }
Ara :
Kod:
{ "IsShowDamage",systemIsShowDamage,METH_VARARGS },
Ekle:
Kod:
{ "SetShowTargetDamageFlag",systemSetShowTargetDamageFlag,METH_VARARGS }, { "IsShowTargetDamage",systemIsShowTargetDamage,METH_VARARGS },
PythonSystem.h Aç ve ara :
Kod:
bShowSalesText
Ekle:
Kod:
boolbShowTargetDamage;
Ara:
Kod:
SetShowSalesTextFlag
Kod:
voidSetShowTargetDamageFlag(int iFlag); boolIsShowTargetDamage();
PythonNetworkStreamPhaseGame.cpp Aç ve ara:
Kod:
#include "PythonApplication.h"
Kod:
#include "PythonSystem.h"
ara:
Kod:
bTarget
Kod:
bool bTarget; if (CPythonSystem::Instance().IsShowTargetDamage()) bTarget = TRUE; else bTarget = (pInstTarget==m_pInstTarget);
PythonSystem.cpp Aç ve ara:
Kod:
m_Config.bShowSalesText= true;
ekle:
Kod:
m_Config.bShowTargetDamage= true;
Ara:
Kod:
void CPythonSystem::SetShowDamageFlag(int iFlag)
Kod:
bool CPythonSystem::IsShowTargetDamage() { return m_Config.bShowTargetDamage; } void CPythonSystem::SetShowTargetDamageFlag(int iFlag) { m_Config.bShowTargetDamage = iFlag == 1 ? true : false; }
Ara:
Kod:
m_Config.bShowSalesText = atoi(value) == 1 ? true : false;
Kod:
else if (!stricmp(command, "SHOW_TARGET")) m_Config.bShowTargetDamage = atoi(value) == 1 ? true : false;
Kod:
fprintf(fp, "USE_DEFAULT_IME%d\n", m_Config.bUseDefaultIME);
Ekle:
Kod:
fprintf(fp, "SHOW_TARGET%d\n", m_Config.bShowTargetDamage);
uigameoption.py aç:
ara:
Kod:
self.RefreshAlwaysShowName() self.RefreshShowDamage()
Kod:
self.RefreshShowTargetDamage()
Ara:
Kod:
self.alwaysShowNameButtonList = [*]
Kod:
self.showTargetDamage = [*]
Kod:
self.showsalesTextButtonList.append(GetObject("salestext_off_button"))
Ekle:
Kod:
self.showTargetDamage.append(GetObject("show_damage2_on_button")) self.showTargetDamage.append(GetObject("show_damage2_off_button"))
Ara:
Kod:
self.showsalesTextButtonList[1].SAFE_SetEvent(self.__OnClickSalesTextOffButton)
Kod:
self.showTargetDamage[0].SAFE_SetEvent(self.__OnClickShowDamage2OnButton) self.showTargetDamage[1].SAFE_SetEvent(self.__OnClickShowDamage2OffButton)
Ara:
Kod:
__OnClickShowDamageOffButton
Ekle:
Kod:
def __OnClickShowDamage2OnButton(self): systemSetting.SetShowTargetDamageFlag(TRUE) self.RefreshShowTargetDamage() def __OnClickShowDamage2OffButton(self): systemSetting.SetShowTargetDamageFlag(FALSE) self.RefreshShowTargetDamage()
ara :
Kod:
def RefreshShowSalesText(self):
2 satır yukarısına ekle:
Kod:
def RefreshShowTargetDamage(self): if systemSetting.IsShowTargetDamage(): self.showTargetDamage[0].Down() self.showTargetDamage[1].SetUp() else: self.showTargetDamage[0].SetUp() self.showTargetDamage[1].Down()
uiscript içinden gameoptiondialog.py aç ve ara:
Kod:
show_damage_off_button
ekle:
Kod:
{ "name" : "show_damage2_on_button", "type" : "radio_button", "x" : LINE_DATA_X+124, "y" : 215 + EK_Y, "text" : "Damage Ac", "default_image" : ROOT_PATH + "middle_button_01.sub", "over_image" : ROOT_PATH + "middle_button_02.sub", "down_image" : ROOT_PATH + "middle_button_03.sub", }, { "name" : "show_damage2_off_button", "type" : "radio_button", "x" : LINE_DATA_X+MIDDLE_BUTTON_WIDTH+121, "y" : 215 + EK_Y, "text" : "Damage Kapa", "default_image" : ROOT_PATH + "middle_button_01.sub", "over_image" : ROOT_PATH + "middle_button_02.sub", "down_image" : ROOT_PATH + "middle_button_03.sub", },
Rakip Damage Aç - Kapa Ekleme Sistemi
Metin2 özel sunucularında güvenlik ve deneyim açısından kritik öneme sahip olan 'Rakip Damage Aç - Kapa' sistemi, PvP odaklı sunucularda sıkça tercih edilmektedir.
Bu sistem sayesinde oyuncular kendi aralarında istedikleri zaman savaşabilir veya barışabilirler. Bu da hem PvP deneyimini artırır hem de gerekli durumlarda saldırıdan kaçınmalarına olanak tanır.
Sistemin Amacı ve Faydaları
Rakip Damage Aç - Kapa sistemi, Metin2 özel sunucularında oyuncuların birbirlerine zarar verebilmesini veya vermeyesini sağlayan bir mekanizmadır. Özellikle PvP sunucularında bu özellik, oyuncuların kendi aralarında turnuvalar yapmasına veya birlikler arasında savaşlar başlatmasına olanak sağlar.
Ancak dikkat edilmesi gereken bir konu vardır: Bu sistemin yanlış veya eksik uygulanması sunucuda güvenlik açıklarına neden olabilir. Bu yüzden sistem C++ kaynak kodlarında doğru şekilde entegre edilmelidir.
Uygulama Adımları
1. Kaynak Kod Düzenlemesi
Öncelikle Game Server kaynak kodlarında değişiklik yapılması gerekir. Bu işlem genellikle C++ dilinde yazılmış olan core dosyalarında yapılır. Rakip Damage açma/kapama sistemi için 'char_battle.cpp', 'char_manager.cpp' gibi dosyalarda değişiklikler yapılmalıdır.
2. Client Tarafında UI Eklemeleri
Client tarafında ise oyuncuların bu sistemi kullanabilmesi için bir buton veya menü eklenmelidir. Bu işlem genellikle 'uiscript' ve 'root' dosyalarında Python tabanlı GUI ile yapılır. Oyuncu arayüzünde 'Damage Aç' veya 'Damage Kapat' gibi butonlar yer almalıdır.
3. Database Entegrasyonu
Oyuncunun durumunu kalıcı olarak saklamak için database tarafında gerekli alanlar oluşturulmalıdır. Bu sayede sunucu yeniden başlatıldığında bile oyuncunun damage ayarı korunur. Bu işlem için 'player' tablosuna yeni bir sütun eklenmelidir.
Python ve C++ Arasındaki Bağlantı
Python GUI tarafında butona basıldığında, bu bilgi C++ core tarafından işlenmelidir. Bu işlem için Python tarafında bir komut gönderilir ve C++ tarafında bu komut dinlenir. Bu iletişim genellikle 'pack.send' ve 'pack.receive' fonksiyonları ile sağlanır.
Güvenlik Uyarıları
Sistem geliştirilirken güvenlik ön planda tutulmalıdır. Özellikle yetkisiz kullanıcıların bu sistemi manipüle etmemesi için kontroller yapılmalıdır. Ayrıca sistemdeki tüm işlemler loglanmalıdır.
Sonuç
Rakip Damage Aç - Kapa sistemi, Metin2 özel sunucularında PvP deneyimini ciddi anlamda artırmaktadır. Doğru şekilde uygulandığında, oyuncular daha fazla kontrol sahibi olur ve sunucu atmosferi daha keyifli hale gelir.
Detaylı kaynak kod örnekleri ve uygulamalı anlatımlar için Metin2Lobby sitemizi takip edin.
Adding Toggle Opponent Damage System
The 'Toggle Opponent Damage' system holds critical importance for security and gameplay experience on Metin2 private servers, especially in PvP-oriented environments.
With this system, players can choose to engage in combat with each other or avoid attacks whenever they want. This enhances the PvP experience while allowing players to avoid unwanted conflicts at times.
Purpose and Benefits of the System
The Opponent Damage Toggle System allows players on Metin2 private servers to enable or disable the ability to deal damage to one another. In PvP-focused servers, this feature enables tournaments among players or battles between guilds.
However, care must be taken: improper or incomplete implementation of this system may cause security vulnerabilities on the server. Therefore, the system must be correctly integrated into the C++ source code.
Implementation Steps
1. Source Code Modifications
Firstly, modifications are required in the Game Server source code. This process typically involves editing core files written in C++. Files such as 'char_battle.cpp' and 'char_manager.cpp' need to be modified for the toggle damage system.
2. UI Additions on the Client Side
On the client side, a button or menu must be added so that players can use this system. This is usually done via Python-based GUI in 'uiscript' and 'root' files. Buttons like 'Enable Damage' or 'Disable Damage' should appear in the player interface.
3. Database Integration
To store the player's state persistently, appropriate fields must be created in the database. This ensures that even after a server restart, the player's damage setting remains intact. A new column must be added to the 'player' table for this purpose.
Connection Between Python and C++
When the button is pressed from the Python GUI side, this information must be processed by the C++ core. A command is sent from the Python side, and listened to on the C++ side. Communication is generally handled using 'pack.send' and 'pack.receive' functions.
Security Warnings
Security must be prioritized during development. Controls must be implemented to ensure unauthorized users cannot manipulate the system. Additionally, all actions within the system should be logged.
Conclusion
The Opponent Damage Toggle System significantly enhances the PvP experience on Metin2 private servers. When properly implemented, players gain more control and the server atmosphere becomes more enjoyable.
For detailed source code examples and practical tutorials, visit our site Metin2Lobby.
