Hikayeler

Reklam vermek için turkmmo@gmail.com

Serverımde Becerı Kıtabı Sıtemı Hakkında

RoeL1907

Kordon2 Offical
TM Üye
Üye
Katılım
2 Mar 2017
Konular
37
Mesajlar
329
Online süresi
632s
Reaksiyon Skoru
27
Altın Konu
0
Başarım Puanı
78
TM Yaşı
9 Yıl 1 Ay 20 Gün
MmoLira
69
DevLira
0

Metin2 EP, Valorant VP dahil tüm oyun ürünlerini en uygun fiyatlarla bulabilir, Item ve Karakterlerinizi hızlıca satabilirsiniz. HEMEN TIKLA!

Merhabalar Serverımde becerı Takas Sıstemı Varda Tek Tek Koyularak 10 Bkye Karaktere uygun 1 bk verıyor ben onu 10lu Toplamda 100 Adet Vererek 10 Adet Bk verdırmek Istıyorum
Yardımcı Olabılırmısınız
Filezilla Bktrade.lua İçeriği Şu Şekildedir

Kod:
quest bk_trade begin
    state start begin
        function get_input(func)
            cmdchat("bk_trade_sys block 0")
            local input = input(cmdchat(func))
            cmdchat("bk_trade_sys break 0")
            if input == "" or string.find(string.lower(input), "nan") or string.find(string.lower(input), "nil") then
                return 0
            else
                return tostring(input)
            end
        end

        when 9004.chat."Kitapları nasıl takas ederim? " begin
            say("Hoş geldin! ")
            say("Bende kitap mı takas edeceksin? Harika! Beceri ve ")
            say("ustalık kitaplarını her zaman alırım. Bana bunlardan ")
            say("10 tane getirirsen sana sıfına uygun bir beceri ")
            say("kitabı veririm. Adil bir pazarlık, değil mi? Ha, ")
            say("neredeyse söylemeyi unutuyordum, bu takas için ")
            say("100.000 Yang isterim.")
        end

        when 9004.chat."Kitap takas et " begin
            setskin(NOWINDOW)
            cmdchat("bk_trade_sys open 0")
        end

        when login begin
            cmdchat("bk_trade_sys qid "..q.getcurrentquestindex())
        end

        function checkflagoverflow()
            if pc.getqf("bk_miktar") > 10 or pc.getqf("bk_miktar") < 0 then
                pc.setqf("bk_miktar", 0)
            end
        end

        when button or info begin
            data = bk_trade.get_input("bk_trade_sys get 0")

            local _, count = string.gsub(data, "|", "")
            if count < 9 or count > 9 then
                syschat("(BK-1)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun") -- Uygunsuz format
                return
            end

            if pc.get_money() < 100000 then
                syschat("Yeterli yang mevcut degil")
                return
            end
            if pc.count_item(50300) < 10 then
                syschat("Yeterli beceri kitabi mevcut degil")
                return
            end
            if pc.get_skill_group() == 0 then
                syschat("Henuz Cok acemisin :(")
                return
            end
            bk_trade.checkflagoverflow()


            splitData = bk_trade.split(data, '|')
            for i = 1, 10 do
                if splitData[i] == "" or string.find(string.lower(splitData[i]), "nan") or string.find(string.lower(splitData[i]), "nil") then
                    syschat("(BK-2)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun") -- Splitlinen icerik boş yada uygunsuz
                    return
                end

                if tonumber(splitData[i]) > 180 or tonumber(splitData[i]) < 0 then
                    -- Gelen slotlar envanter slot miktarından farklı[min 0, max 90]
                    -- Envanter sayısınız 2den farklıysa 90 kısmına her sayfa için +45 ekleyin
                    -- 4 Sayfa envanter için 180 gibi
                    syschat("(BK-3)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun")
                    return
                end

                item.select_cell(splitData[i])
                if not item.get_id() or item.get_id() == 0 then
                    syschat("Item bulunamadi> " ..splitData[i])
                    return
                end

                if tostring(item.get_vnum()) != tostring(50300) then
                    syschat("(BK-4)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun") -- beceri kitabı vnumu değilse iptal
                    return
                end
                if tostring(item.get_count()) != tostring(1) then
                    syschat("(BK-5)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun") -- miktar 1 den farklıysa iptal
                    return
                end

                pc.setqf("bk_miktar", pc.getqf("bk_miktar") + 1)
                item.remove()

            end

            if pc.getqf("bk_miktar") == 10 then
                local x
                if pc.get_job() <= 1 then
                    x = number(1,5)
                else
                    x = number(1,6)
                end
                bk_trade.give_new_book(x)
                return
            else
                syschat("(BK-6)Bilinmeyen hata. Lutfen oyun yoneticisine basvurun") -- BK Flagları 10dan farklı uygunsuz durum
                return
            end

        end

        function give_new_book(sock)
            local skill_list = special.active_skill_list[pc.get_job()+1][pc.get_skill_group()]
            if pc.get_money() < 100000 then
                syschat("Yeterli yang mevcut degil")
                return
            end

            pc.change_gold(-100000)
            pc.give_item2_select(50300)
            item.set_socket(0, skill_list[sock])
            pc.setqf("bk_miktar", 0)
            return
        end

        function split(command_, x)
            return bk_trade.split_(command_,x)
        end

        function split_(string_,delimiter)
            local result = { }
            local from  = 1
            local delim_from, delim_to = string.find( string_, delimiter, from  )
            while delim_from do
                table.insert( result, string.sub( string_, from , delim_from-1 ) )
                from  = delim_to + 1
                delim_from, delim_to = string.find( string_, delimiter, from  )
            end
            table.insert( result, string.sub( string_, from  ) )
            return result
        end
    end
end

Root Dosyamda Bktrade.py Icerıği Su Sekildedir

Kod:
from ui_wrapper import _ui
import dbg, player, item, event, systemSetting
import ui, mouseModule, uiToolTip, constInfo

class BKTrade(ui.Window):
    def __init__(self):
        ui.Window.__init__(self)

        self.ItemList = [] #vnum list
        self.ItemDict = {} #slot wrapper
        self.Grids = {}    #gui grid elements

        self.tooltipItem = uiToolTip.ItemToolTip()
        self.tooltipItem.Hide()

        self.GUIFunc()

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

    def GUIFunc(self):
        self.Board = _ui().BoardWithTitleBar(None, 1, systemSetting.GetWidth() /2 -200, 50, 230, 170, "Kitap takas et", self.OpenWindow) # parent moveable x y width heigh title event
        self.Price = _ui().TextLine(self.Board, "Ucret: 100.000 Yang", 65, 115)
        self.Accept = _ui().Button(self.Board, "Tamam", "", 45, 135, self.SendToServer, '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')
        self.Cancel = _ui().Button(self.Board, "Iptal", "", 125, 135, self.OpenWindow, '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')
        #self.ClearGrids = _ui().Button(self.Board, "", "Temizle", 200, 32, self.RemoveAllItems, "d:/ymir work/ui/game/guild/refresh_button_01.sub", "d:/ymir work/ui/game/guild/refresh_button_02.sub", "d:/ymir work/ui/game/guild/refresh_button_03.sub")

        pos_list = [
            [32,40],[32*2,40],[32*3,40],[32*4,40],[32*5,40],
            [32,72],[32*2,72],[32*3,72],[32*4,72],[32*5,72]
        ]
        for i in xrange(len(pos_list)):
            self.Grids["Tab"+str(i)] = _ui().GridSlotWindow(self.Board, pos_list[i][0], pos_list[i][1], self.SelectItemSlot, self.RemoveItem, self.OverInItem, self.OnOverOutItem, i, 1, 1, 32, 32, 0, 0)

    def SendToServer(self):
        if not len(self.ItemList) == 10: #Check Grid count
            self.Notification = _ui().Popup("Eksik bk mevcut!", None, None)
            return

        tmpInventoryPosList = [] # Create Temporary Inventory pos list
        for i in self.ItemList:
            tmpInventoryPosList.append(self.ItemDict[i])

        asStringPosList = '|'.join(str(i) for i in tmpInventoryPosList) # Convert Inventory pos list to string

        constInfo.BK_TRADE_SYSTEM["ItemList"] = asStringPosList
        event.QuestButtonClick(int(constInfo.BK_TRADE_SYSTEM["qid"]))
        self.RemoveAllItems()

    #@Unofficial func
    def RemoveAllItems(self):
        # All items from list
        del self.ItemList[:]
        self.ItemDict.clear() # All items from dict
        for i in xrange(5*2):
            self.Grids["Tab"+str(i)].SetItemSlot(i, 0, 0) # Set all grid items as 0
            self.Grids["Tab"+str(i)].RefreshSlot() # Reload grids

    #@Tooltip select item event
    def OverInItem(self, itemSlotIndex):
        #itemSlotIndex -> Grid slot - self.ItemDict[itemSlotIndex] -> Inventory slot - itemIndex -> Vnum
        itemIndex = player.GetItemIndex(self.ItemDict[itemSlotIndex])
        item.SelectItem(itemIndex)

        metinSlot = [player.GetItemMetinSocket(self.ItemDict[itemSlotIndex], i) for i in xrange(player.METIN_SOCKET_MAX_NUM)] # Socket list
        attrSlot = [player.GetItemAttribute(self.ItemDict[itemSlotIndex], i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]  # Attr list

        self.tooltipItem.ClearToolTip()
        self.tooltipItem.AddRefineItemData(itemIndex, metinSlot, attrSlot)
        self.tooltipItem.Show()

    #@Tooltip unselect item event
    def OnOverOutItem(self):
        self.tooltipItem.ClearToolTip()
        self.tooltipItem.Hide()

    #@Remove Item event from grids
    def RemoveItem(self, idx):
        self.ItemList.remove(idx)
        del self.ItemDict[idx]
        self.Grids["Tab"+str(idx)].SetItemSlot(idx, 0, 0)
        self.Grids["Tab"+str(idx)].RefreshSlot()

    #@Append Item event to grids
    def SelectItemSlot(self, itemSlotIndex):
        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            if player.IsEquipmentSlot(attachedSlotPos):
                self.Notification = _ui().Popup("Ekipman ekleyemezsin!", None, None)
                mouseModule.mouseController.DeattachObject()
                return
            if attachedSlotPos in self.ItemDict.values():
                self.Notification = _ui().Popup("Ayni Itemi Tekrar Ekleyemezsin!", None, None)
                mouseModule.mouseController.DeattachObject()
                return
            itemIndex = player.GetItemIndex(attachedSlotPos)
            if not itemIndex == 50300:
                self.Notification = _ui().Popup("Sadece beceri kitabi konulabilir!", None, None)
                mouseModule.mouseController.DeattachObject()
                return
            itemCount = player.GetItemCount(attachedSlotPos)
            if itemCount > 1:
                self.Notification = _ui().Popup("Kitaplari tek tek yerlestirin!", None, None)
                mouseModule.mouseController.DeattachObject()
                return
            item.SelectItem(itemIndex)

            if itemCount == 1:
                self.Grids["Tab"+str(itemSlotIndex)].SetItemSlot(itemSlotIndex, itemIndex, 0)
            else:
                self.Grids["Tab"+str(itemSlotIndex)].SetItemSlot(itemSlotIndex, itemIndex, itemCount)

            self.ItemDict[itemSlotIndex] = attachedSlotPos
            self.ItemList.append(itemSlotIndex)

            mouseModule.mouseController.DeattachObject()

    def OpenWindow(self):
        if self.Board.IsShow():
            self.Board.Hide()
        else:
            self.Board.Show()

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

#BKTrade()
 
Son düzenleme:
Kod:
if not len(self.ItemList) == 10: #Check Grid count self.Notification = _ui().Popup("Eksik bk mevcut!", None, None) return

if itemCount > 1: self.Notification = _ui().Popup("Kitaplari tek tek yerlestirin!", None, None) mouseModule.mouseController.DeattachObject() return item.SelectItem(itemIndex)

pythonda bu kısımlar da değişebilir
 

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

Geri
Üst