Pet isim değiştirme

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

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
açık petsystem.cpp find:


Kodu:
#include "item.h"
eklemek

Kodu:
#include "db.h"
bulmak:

Kodu:
void CPetActor :: SetName ( const karakter * adı )
Kod bloğunu değiştirin:

Kodu:
void CPetActor :: SetName ( const karakter * adı )
{
std :: dize petName = m_pkOwner -> getName ();

eğer ( 0 ! = m_pkOwner &&
0 == adı &&
0 ! = m_pkOwner -> getName ())
{
petName + = " 'ın Pet" ;
}
else
petName + = isim ;

Char sorgu [ 512 ];
snprintf ( sorgu , sizeof ( sorgu ), "pet_name ad seçin WHERE id = %u" , m_pkOwner -> GetPlayerID ());
std :: auto_ptr < SQLMsg > cekgelsin ( DBManager :: instance (). DirectQuery ( sorgu ) );
if ( cekgelsin -> Get ()-> uiNumRows != 0 )
{
MYSQL_ROW row = mysql_fetch_row ( cekgelsin -> Get ()-> pSQLResult );
char petad [ CHARACTER_NAME_MAX_LEN + 1 ];
strlcpy ( petad , row [ 0 ], sizeof ( petad ));
petName = petad ;
}

Eğer ( gerçek == IsSummoned ())
m_pkChar -> SetName ( petName );

m_Name = petName ;
}
Açık questlua_pet.cpp bulmak:


Kodu:
#include "PetSystem.h"
eklemek
Kodu:
#include "db.h"

bulmak

Kodu:
int pet_spawn_effect ( lua_State * L )
Kod bloğunu ekleyin

Kodu:
int pet_namever ( lua_State * L )
{
LPCHARACTER ch = CQuestManager :: örneği (). GetCurrentCharacterPtr () ;

eğer ( lua_isstring ( L , 1 ) =! true )
{
lua_pushnumber ( L , 1 );
return 1 ;
}

const karakter * szName = lua_tostring ( L , 1 );

Char sorgu [ 512 ];
snprintf ( sorgu , sizeof ( sorgu ), "% (pet_name DEĞERLERİ REPLACE INTO u, '%s')" , ch -> GetPlayerID (), szName );
std :: auto_ptr < SQLMsg > yolla ( DBManager :: instance (). DirectQuery ( sorgu ) );
if ( yolla -> Get ()-> uiAffectedRows != 0 )
{
lua_pushnumber ( L , 3 );
return 3 ;
}

return 4 ;
}
bulmak

Kodu:
{ "Spawn_effect" , pet_spawn_effect }
eklemek

Kodu:
{ "Adver" , pet_namever }



Navicat MySQL sorgusu: Açık Navicat> için "Query" tıklayın:



Kodu:
DROP TABLE IF EXISTS `pet_name` ;
CREATE TABLE ` pet_name` (
`id` int ( 11 ) NOT NULL DEFAULT '0' ,
` name` varchar ( 24 ) KARAKTER SETİ utf8 HARMANLA utf8_turkish_ci NOT NULL DEFAULT 'NONAME' ,
PRIMARY KEY ( `id` )
) ENGINE = MyISAM DEFAULT CHARSET = utf8 HARMANLA = utf8_turkish_ci ;
Quest_functions bölgesindeki ekle

Kodu:
pet . adver
Görev:

Kodu:
arayışı ademin başlamak
başlamak durumu başlaması
zaman 71115.use başlar
say_title ( "yeni ver isim" )
yerel str = girişi ()
eğer str == "" veya str == nill sonra
say_title ( "Kutuyu bos birakma" )
return
end

eğer dize . len ( str ) <= 0 veya dize . len ( str ) > 12 sonra
say_title ( "isim En Fazla 12 karakter Olabilir" )
return
end

local tt = "%'"
local ct = "%:"
local nk = "%."
local vg = "%,"
if string . find ( str , tt ) or string . find ( str , ct ) or string . find ( str , nk ) or string . find ( str , vg ) then
say_title ( "ozel İşaret kullanamazsin " )
return
end

Yerel t = pet . adver ( str )
say_title ( "pet adi degistirildi. peti gonder" )
ise t == 1 sonra
say_title ( "Kutuyu bos bırakma" )
return
t elseif == 2 sonra
say_title ( "12 karakteri gecme" )
return
elseif t == 3 sonra
say_title ( "isim Degisti" )
end
end
end
end
Kodu:
Yerel tt = "% '"
yerel ct = "%:"
Yerel nk = ".%"
Yerel VG = "%"


Pet Isim Değiştirme Sistemi Nedir ve Metin2'de Nasıl Uygulanır?

Metin2 özel sunucularında geliştirme yaparken kullanıcı deneyimini artırmak için birçok küçük ama etkili sistem entegre edilir. Bunlardan biri de pet isim değiştirme sistemidir. Bu sistem sayesinde oyuncular evcil hayvanlarına kendi istedikleri isimleri verebilirler. Bu da hem daha kişisel bir deneyim sunar hem de oyun içi etkileşimi artırır.[/BR][/BR]
Pet Sistemi Nedir?

Metin2 oyununda pet sistemi uzun zamandır mevcuttur. Oyuncular, belirli seviyelere geldikçe evcil hayvanlar edinebilir ve bu hayvanlarla birlikte savaşabilirler. Petlerin bazıları hasar artırıcı, bazıları savunma sağlayıcı veya can yenileyici efektler sunar. Ancak bu petlerin varsayılan isimleri oldukça geneldir ve her oyuncu tarafından aynıdır. İşte burada devreye pet isim değiştirme sistemi girer.

Pet Isim Değiştirme Sisteminin Avantajları

Oyuncuların evcil hayvanlarını kişiselleştirmesi, onlara duygusal bağ kurmalarını sağlar. Bu da oyun içi bağlılığı artırır ve oyuncuların sunucuya daha uzun süre kalmasını teşvik eder. Ayrıca, PvP ortamında bir peti tanımlamak kolaylaşır çünkü her petin kendine özgü bir adı vardır.[/BR][/BR]
Sistem Nasıl Çalışır?

Genellikle bu sistem, C++ tabanlı bir sunucu üzerinde geliştirilir. Sunucu tarafında bir komut veya GUI üzerinden oyuncu, belirli bir eşya veya coin karşılığında pet ismini değiştirebilir. Bu işlem sırasında sunucu, yeni ismin uygunluğunu kontrol eder (örneğin küfür içerip içermediği gibi). Eğer isim kabul edilirse, veritabanında (db) petin ismi güncellenir ve oyun içi arayüzde (uiscript) değişiklik yansıtılır.

Python ile GUI Entegrasyonu

Metin2 özel sunucularında GUI sistemleri genellikle Python dilinde yazılmaktadır. PyRoot ve PyUI kullanılarak geliştirilen bu sistemler, pet isim değiştirme işlemini kullanıcı dostu bir arayüzle sağlar. Örneğin bir 'Pet Isim Değiştir' penceresi açılır, oyuncudan yeni isim alınır ve sunucuya gönderilir. [/BR][/BR]
Sunucu Tarafında Uygulama

Sunucu tarafında (game/src), pet nesnesi üzerinde bir fonksiyon tanımlanır. Bu fonksiyon, gelen isim parametresini doğrular ve veritabanına işler. Bu işlem sırasında auth veya game sunucusu arasında senkronizasyon sağlanmalıdır ki isim değişikliği tüm kanallarda geçerli olsun.

Veritabanı Yönü

Metin2 sistemlerinde genellikle MySQL veritabanı kullanılır. Pet isimleri genellikle 'pet' ya da 'player' tablosunda saklanır. Bu tabloya yeni bir alan eklenerek isim değiştirme işlemi desteklenebilir. Örneğin: 'pet_name' alanı yeni bir isim için kullanılabilir.

Kullanıcı Deneyimi Arttırma

Bu sistem, sadece isim değiştirmeyle sınırlı kalmadan, örneğin özel karakter seti desteklemek, emoji veya özel semboller eklemek gibi gelişmiş özelliklerle genişletilebilir. Bu, özellikle özel sunucuların rekabet avantajı sağlamasını sağlar.[/BR][/BR]
Sonuç

Pet isim değiştirme sistemi, Metin2 özel sunucularında kullanıcı memnuniyetini ve oyun içi etkileşimi artıran küçük ama etkili bir özelliktir. C++, Python, veritabanı ve GUI bilgisiyle kolayca entegre edilebilir. Bu tür sistemler, sunucunuzun kalitesini ve oyuncu sadakatini yükseltmede büyük rol oynar.


What is the Pet Name Change System and How is it Implemented in Metin2?

While developing private Metin2 servers, many small but effective systems are integrated to enhance user experience. One of these is the pet name change system. This system allows players to assign their own desired names to their pets. This creates a more personal experience and increases in-game interaction.[/BR][/BR]
What is the Pet System?

The pet system in Metin2 has been available for a long time. As players reach certain levels, they can acquire pets and fight alongside them. Some pets provide damage bonuses, while others offer defense or health regeneration effects. However, these pets typically have generic names that are the same for all players. This is where the pet name change system comes into play.

Advantages of the Pet Name Change System

Allowing players to personalize their pets helps them form emotional connections with them. This increases in-game attachment and encourages players to stay longer on the server. Additionally, identifying a pet in PvP environments becomes easier since each pet has its own unique name.[/BR][/BR]
How Does the System Work?

Usually, this system is developed on a C++ based server. Via a command or GUI interface, players can rename their pets in exchange for a specific item or coins. During this process, the server checks the validity of the new name (e.g., whether it contains inappropriate language). If the name is accepted, it is updated in the database (db) and reflected in the in-game UI (uiscript).

GUI Integration with Python

In Metin2 private servers, GUI systems are often written in Python. These systems, utilizing PyRoot and PyUI, allow for a user-friendly interface for changing pet names. For example, a 'Rename Pet' window opens, the player enters a new name, and it is sent to the server.[/BR][/BR]
Server-Side Implementation

On the server side (game/src), a function is defined on the pet object. This function validates the incoming name parameter and writes it to the database. During this process, synchronization between the auth or game server must be maintained so that the name change is valid across all channels.

Database Aspect

In Metin2 systems, MySQL databases are commonly used. Pet names are usually stored in the 'pet' or 'player' table. A new field can be added to this table to support name changes. For example: the 'pet_name' field can be used for the new name.

Improving User Experience

This system can be extended beyond simple name changes to support advanced features like custom character sets, emojis, or special symbols. This can provide competitive advantages especially for private servers.[/BR][/BR]
Conclusion

The pet name change system is a small but impactful feature that enhances user satisfaction and in-game interaction in Metin2 private servers. It can easily be integrated using knowledge of C++, Python, databases, and GUIs. Such systems play a significant role in improving your server's quality and player loyalty.
 

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

Benzer konular

Geri
Üst Alt