Fethi Polat 1
Fethi Polat
xranzei 1
xranzei
Bvural41 1
Bvural41
kralhakan2009 1
kralhakan2009
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Vahsi Uzman 1
Vahsi Uzman
Cannn6161 1
Cannn6161
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

[NYS.X] Metin2 Profil Sistemi [C++ / Python]

  • Konuyu başlatan Konuyu başlatan NYSX
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 1
  • Görüntüleme Görüntüleme 3K
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

NYSX

Born to die
Telefon Numarası Onaylanmış Üye TC Kimlik Numarası Doğrulanmış Üye
TM Üye
Katılım
30 Eyl 2018
Konular
373
Mesajlar
2,104
Çözüm
30
Online süresi
1h 22m
Reaksiyon Skoru
3,385
Altın Konu
0
TM Yaşı
7 Yıl 8 Ay 12 Gün
Başarım Puanı
258
MmoLira
157
DevLira
-21
Ticaret - 100%
1   0   0

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

Öncelikle merhaba sistem kesinlikle bana ait değildir, fakat arapça bir suudi arabistanlı arkadaş hazırlamış ve bende sistemi türkçeye çevirip daha ingilizce sürümü dahi yokken sizlere sunmak istedim. Maksat yardımlaşmak. Daha fazla konuyu uzatmadan detaylara geçiyorum nasıl yapacağımız konusunda.
game.py dosyası üzerinde yapacağımız değişiklikler bunlardır :

# Dosyanın en başına ekleyin
Kod:
import uiprofile

# Bu kodu bulun ve hemen altına
Kod:
self.__ProcessPreservedServerCommand()

# Bu kodu ekleyin
Kod:
self.uiprofile = uiprofile.ProfileWindoww()

# Bu kodu bulun ve hemen altına
Kod:
def Close(self):

# Bu kodu ekleyin
Kod:
self.uiprofile.Close()

#ا Bu kodu bulun ve hemen altına
Kod:
onPressKeyDict[app.DIK_F4]    = lambda : self.__PressQuickSlot(7)

# Bu kodu ekleyin
Kod:
onPressKeyDict[app.DIK_F6]    = lambda : self.__OpenProfile()

# Bu kodu bulun ve hemen altına
Kod:
def BINARY_NEW_RemoveAffect(self, type, pointIdx):

# Bu kodu ekleyin
Kod:
    def OpenProfileDialog(self,Name,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note):
        self.uiprofile.OpenWindow(Name,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note)

# Dosyanın en sonuna ekleyin.
Kod:
    def __OpenProfile(self):
        name = player.GetName()
        net.SendChatPacket("/view_profile " + str(name))

game.py üzerinde yapacağımız işlemler bitti. Şimdi orada olmayan bir dosya oluşturacağız. "game.py'nin bulunduğu dizine" yeni bir dosya oluşturacağız.

Adını : uiprofile.py olarak koymalısınız.

İçerisine ekleyeceğiniz içerik budur :
Kod:
import ui
import dbg
import app
import wndMgr
import net
import player
import localeInfo
import chr
import chat

class ProfileWindoww(ui.Window):
    class TextToolTip(ui.Window):
        def __init__(self):
            ui.Window.__init__(self, "TOP_MOST")

            textLine = ui.TextLine()
            textLine.SetParent(self)
            textLine.SetHorizontalAlignCenter()
            textLine.SetOutline()
            textLine.Show()
            self.textLine = textLine

        def __del__(self):
            ui.Window.__del__(self)

        def SetText(self, text):
            self.textLine.SetText(text)

        def OnRender(self):
            (mouseX, mouseY) = wndMgr.GetMousePosition()
            self.textLine.SetPosition(mouseX, mouseY - 15)
    def __init__(self):
        ui.Window.__init__(self)
        self.BuildWindow()
    

    def __del__(self):
        ui.Window.__del__(self)

    def BuildWindow(self):
        self.Board = ui.BoardWithTitleBar()
        self.Board.SetSize(270, 465)
        self.Board.SetPosition(68, wndMgr.GetScreenHeight()-650)
        self.Board.AddFlag('movable')
        self.Board.SetTitleName("ÇáãáÝ ÇáÔÎÕí")
        self.Board.AddFlag('float')
        self.Board.Hide()
        self.comp = Component()
        self.blockval=64

        self.txtName = self.comp.TextLine(self.Board, 'ÇáÃÓã ', 255, 28+14, self.comp.RGB(255, 255, 255))
        self.txtGander = self.comp.TextLine(self.Board, 'ÇáÌäÓ ', 120, 28+14, self.comp.RGB(255, 255, 255))
        self.txtDeeanh = self.comp.TextLine(self.Board, 'ÇáÏíÇäå ', 255, 28+(2*28), self.comp.RGB(255, 255, 255))
        self.txtAge = self.comp.TextLine(self.Board, 'ÇáÚãÑ', 110, 28+(2*28), self.comp.RGB(255, 255, 255))
        self.txtCity = self.comp.TextLine(self.Board, 'ÇáÈáÏ', 255, 28+(3*28+14), self.comp.RGB(255, 255, 255))
        self.txtCountry = self.comp.TextLine(self.Board,  'ÇáãÏíäÉ', 120, 28+(3*28+14), self.comp.RGB(255, 255, 255))
        self.txtFcbook = self.comp.TextLine(self.Board,  'ÇáÝíÓ Èæß', 255, 28+(5*28), self.comp.RGB(255, 255, 255))
        self.txtWebsite = self.comp.TextLine(self.Board,  'ãæÞÚß', 255, 28+(7*28), self.comp.RGB(255, 255, 255))
        self.txtSkype = self.comp.TextLine(self.Board,  'ÓÜßÜÜÇí Èí', 255, 28+(9*28), self.comp.RGB(255, 255, 255))
        self.txtNote = self.comp.TextLine(self.Board,  'ãáÇÍÙÇÊ', 255, 28+(11*28), self.comp.RGB(255, 255, 255))
        
        self.Update_btn = ui.Button()
        self.Update_btn.SetParent(self.Board)
        self.Update_btn.SetPosition(150,28+(13*28)+18+18)
        self.Update_btn.SetUpVisual('d:/ymir work/ui/public/Large_Button_01.sub')
        self.Update_btn.SetOverVisual('d:/ymir work/ui/public/Large_Button_02.sub')
        self.Update_btn.SetDownVisual('d:/ymir work/ui/public/Large_Button_03.sub')
        self.Update_btn.SetText("ÊÜÜÍÜÜÏíÜË")
        self.Update_btn.SetEvent(ui.__mem_func__(self.UpdateEvent))
        self.Update_btn.Show()    
        
        self.blockBtn = self.comp.ToggleButton(self.Board, 'ãÔÇåÏÉ', '', 20, 28+(13*28)+18+18, (lambda arg = 'off': self.btnblock_func(arg)), (lambda arg = 'on': self.btnblock_func(arg)), 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
        
    def OpenWindow(self,Name="",Gander="",Deeanh="",Age="",City="",Country="",Fcbook="",Website="",Skype="",Note=""):
        name = player.GetName()
        if Name != name:
            self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False)
            self.editGander = self.comp.EditLine(self.Board,str(Gander), 57, 28+14+18, 55,20,6,False,False)
            self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,False,False)
            self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,False,False)
            self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,False,False)
            self.editCountry = self.comp.EditLine(self.Board, str(Country), 27,  28+(3*28+14)+18, 100,20,11,False,False)
            self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,False,False)
            self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,False,False)
            self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,False,False)
            self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,False,True)
            self.Update_btn.Hide()
            self.blockBtn.Hide()        
        else:
            self.editName = self.comp.EditLine(self.Board,str(Name), 147, 28+14+18, 100,20,24,False,False)
            self.editGander = self.comp.EditLine(self.Board,str(Gander), 57, 28+14+18, 55,20,6,True,False)
            self.editDeeanh = self.comp.EditLine(self.Board, str(Deeanh), 183, 28+(2*28)+18, 65,20,6,True,False)
            self.editAge = self.comp.EditLine(self.Board,str(Age), 57, 28+(2*28)+18, 55,20,6,True,False)
            self.editCity = self.comp.EditLine(self.Board, str(City), 183, 28+(3*28+14)+18, 65,20,11,True,False)
            self.editCountry = self.comp.EditLine(self.Board, str(Country), 27,  28+(3*28+14)+18, 100,20,11,True,False)
            self.editFcbook = self.comp.EditLine(self.Board,str(Fcbook), 83, 28+(5*28)+18, 170,20,24,True,False)
            self.editWebsite = self.comp.EditLine(self.Board, str(Website), 83, 28+(7*28)+18, 170,20,24,True,False)
            self.editSkype = self.comp.EditLine(self.Board, str(Skype), 83, 28+(9*28)+18, 170,20,24,True,False)
            self.editNote = self.comp.EditLine(self.Board, str(Note), 53, 28+(11*28)+18, 200,60,80,True,True)
            self.Update_btn.Show()
            self.blockBtn.Show()    
    
        if self.Board.IsShow():
            self.Board.Hide()
        else:
            self.Board.Show()
    def UpdateEvent(self):
        self.CheckInfo(str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))
        player.UpdateProfile(str(self.editName[1].GetText()),str(self.editGander[1].GetText()),str(self.editDeeanh[1].GetText()),str(self.editAge[1].GetText()),str(self.editCity[1].GetText()),str(self.editCountry[1].GetText()),str(self.editFcbook[1].GetText()),str(self.editWebsite[1].GetText()),str(self.editSkype[1].GetText()),str(self.editNote[1].GetText()))
        chat.AppendChat(chat.CHAT_TYPE_INFO,"clickd")

    def btnblock_func(self, arg, do=1):
        if self.blockval == 64:
            net.SendChatPacket("/setblockmode " + str(self.blockval))
            self.blockBtn.Down()
            self.blockval = 32
        else:
            net.SendChatPacket("/setblockmode " + str(self.blockval))
            self.blockBtn.SetUp()
            self.blockval = 64
    
    
    def CheckInfo(self,Gander,Deeanh,Age,City,Country,Fcbook,Website,Skype,Note):
        if len(Gander)==0:
            Gander = "..."
            self.editGander[1].SetText(str(Gander))
        if len(Deeanh)==0:
            Deeanh = "..."
            self.editDeeanh[1].SetText(str(Deeanh))
        if  len(Age)==0:
            Age = "1"
            self.editAge[1].SetText(str(Age))
        if  len(City)==0:
            City = "...."
            self.editCity[1].SetText(str(City))
        if  len(Country)==0:
            Country = "...."    
            self.editCountry[1].SetText(str(Country))
        if  len(Fcbook)==0:
            Fcbook = "fb.com/xxx"
            self.editFcbook[1].SetText(str(Fcbook))
        if  len(Website)==0:
            Website = "ww.xxx.com"
            self.editWebsite[1].SetText(str(Website))
        if  len(Skype)==0:
            Skype = "....."
            self.editSkype[1].SetText(str(Skype))
        if  len(Note)==0:
            Note = "................................"
            self.editNote[1].SetText(str(Note))

    def Close(self):
        self.Board.Hide()

class Component:
    def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
        button = ui.ToggleButton()
        if parent != None:
            button.SetParent(parent)
        button.SetPosition(x, y)
        button.SetUpVisual(UpVisual)
        button.SetOverVisual(OverVisual)
        button.SetDownVisual(DownVisual)
        button.SetText(buttonName)
        button.SetToolTipText(tooltipText)
        button.Show()
        button.SetToggleUpEvent(funcUp)
        button.SetToggleDownEvent(funcDown)
        return button

    def EditLine(self, parent, editlineText, x, y, width, heigh, max,isMe,isMulteLine):
        SlotBar = ui.SlotBar()
        if parent != None:
            SlotBar.SetParent(parent)
        SlotBar.SetSize(width, heigh)
        SlotBar.SetPosition(x, y)
        SlotBar.Show()
        if isMe==True:
            Value = ui.EditLine()
        else:
            Value = ui.TextLine()
        Value.SetParent(SlotBar)
        Value.SetSize(width, heigh)
        Value.SetPosition(1, 1)
        Value.SetLimitWidth(width)
        Value.SetMax(max)
        Value.GetText()
        Value.SetText(editlineText)
        if isMulteLine == True:
            Value.SetMultiLine()
        
        Value.Show()
        return SlotBar, Value

    def TextLine(self, parent, textlineText, x, y, color):
        textline = ui.TextLine()
        if parent != None:
            textline.SetParent(parent)
        textline.SetPosition(x, y)
        if color != None:
            textline.SetFontColor(color[0], color[1], color[2])
        textline.SetText(textlineText)
        textline.Show()
        return textline

    def RGB(self, r, g, b):
        return (r*255, g*255, b*255)

    def ExpandedImage(self, parent, x, y, img):
        image = ui.ExpandedImageBox()
        if parent != None:
            image.SetParent(parent)
        image.SetPosition(x, y)
        image.LoadImage(img)
        image.Show()
        return image
    
    def Gauge(self, parent, width, color, x, y):
        gauge = ui.Gauge()
        if parent != None:
            gauge.SetParent(parent)
        gauge.SetPosition(x, y)
        gauge.MakeGauge(width, color)
        gauge.Show()
        return gauge


sonrasında "uitarget.py" dosyasını açalım ve aşağıdaki adımları uygulayalım.

# Bu kodu bulun ve hemen altına
Kod:
localeInfo.TARGET_BUTTON_FRIEND,

# Bu kodu ekleyin
Kod:
"Dosya",

# Bu kodu bulun ve hemen altına
Kod:
self.buttonDict[localeInfo.TARGET_BUTTON_INVITE_GUILD].SAFE_SetEvent(self.__OnGuildAddMember)

# Bu kodu ekleyin
Kod:
self.buttonDict["Profil"].SetEvent(ui.__mem_func__(self.__OnViewProfile))

# Bu kodu bulun ve hemen altına
Kod:
self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT])

# Bu kodu ekleyin
Kod:
self.showingButtonList.append(self.buttonDict["Profil"])

# Bu kodu bulun ve hemen altına
Kod:
def __OnExitObserver(self):

# Bu kodu ekleyin
Kod:
    def __OnViewProfile(self):
        name = chr.GetNameByVID(self.vid)
        net.SendChatPacket("/view_profile " + str(name))
        chat.AppendChat(chat.CHAT_TYPE_INFO,"hedef "+str(name))

şimdi sıra geldi navicata tarafına yani mysql ekleyeceğimize.

Kod:
SET FOREIGN_KEY_CHECKS=0;

DROP TABLE IF EXISTS `profile_system`;
CREATE TABLE `profile_system` (
  `player_name` varchar(32) CHARACTER SET latin1 NOT NULL DEFAULT 'NONAME',
  `Gander` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Deeanh` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Age` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `City` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Country` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Fcbook` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Website` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Skype` varchar(32) CHARACTER SET latin1 DEFAULT '',
  `Note` varchar(85) CHARACTER SET latin1 DEFAULT '',
  PRIMARY KEY (`player_name`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1256;

C++ Source taraflı eklenecekleri konu daha fazla uzun olmasın diye upload edip paylaşmak istedim. Bunları yaptıktan sonra source tarafınada eklediğinizde sistem sorunsuz olarak çalışacaktır. Ek olarak burada yaptığınız işlemlerin anlatımı dosya içerisindede mevcuttur.


 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst