Jump to content

Problem Costume Bonuses Transfer python


Recommended Posts

Hi all.I have a problem with a system in python with the function over an item i have the sistem transfer bonuses from a costum too another and the 3 slot the result bethwen them doesent work when i go with mouse over it and i get a syserr

Spoiler

0104 12:43:57289 :: Traceback (most recent call last):

0104 12:43:57289 ::   File "ui.py", line 1485, in OnOverInItem

0104 12:43:57290 ::   File "ui.py", line 87, in __call__

0104 12:43:57290 ::   File "ui.py", line 78, in __call__

0104 12:43:57290 ::   File "uibonustransfer.py", line 109, in OverInItem

0104 12:43:57290 :: AttributeError
0104 12:43:57290 :: :
0104 12:43:57290 :: 'ItemToolTip' object has no attribute 'SetControledToolTip'
0104 12:43:57290 ::

0104 12:43:59286 :: Traceback (most recent call last):

0104 12:43:59286 ::   File "ui.py", line 1485, in OnOverInItem

0104 12:43:59286 ::   File "ui.py", line 87, in __call__

0104 12:43:59286 ::   File "ui.py", line 78, in __call__

0104 12:43:59287 ::   File "uibonustransfer.py", line 109, in OverInItem

0104 12:43:59287 :: AttributeError
0104 12:43:59287 :: :
0104 12:43:59287 :: 'ItemToolTip' object has no attribute 'SetControledToolTip'
0104 12:43:59287 ::

0104 12:43:02902 :: Traceback (most recent call last):

0104 12:43:02902 ::   File "ui.py", line 1485, in OnOverInItem

0104 12:43:02902 ::   File "ui.py", line 87, in __call__

0104 12:43:02902 ::   File "ui.py", line 78, in __call__

0104 12:43:02903 ::   File "uibonustransfer.py", line 109, in OverInItem

0104 12:43:02903 :: AttributeError
0104 12:43:02903 :: :
0104 12:43:02903 :: 'ItemToolTip' object has no attribute 'SetControledToolTip'
0104 12:43:02903 ::

0104 12:43:19872 :: Traceback (most recent call last):

0104 12:43:19872 ::   File "ui.py", line 1485, in OnOverInItem

0104 12:43:19873 ::   File "ui.py", line 87, in __call__

0104 12:43:19873 ::   File "ui.py", line 78, in __call__

0104 12:43:19873 ::   File "uibonustransfer.py", line 109, in OverInItem

0104 12:43:19874 :: AttributeError
0104 12:43:19874 :: :
0104 12:43:19874 :: 'ItemToolTip' object has no attribute 'SetControledToolTip'
0104 12:43:19874 ::

0104 13:49:33306 :: kostumekran
0104 13:49:36422 :: Traceback (most recent call last):

0104 13:49:36422 ::   File "ui.py", line 1485, in OnOverInItem

0104 13:49:36422 ::   File "ui.py", line 87, in __call__

0104 13:49:36422 ::   File "ui.py", line 78, in __call__

0104 13:49:36463 ::   File "uibonustransfer.py", line 111, in OverInItem

0104 13:49:36463 :: KeyError
0104 13:49:36463 :: :
0104 13:49:36463 :: 403
0104 13:49:36463 ::

0104 13:49:37055 :: Traceback (most recent call last):

0104 13:49:37055 ::   File "ui.py", line 1485, in OnOverInItem

0104 13:49:37055 ::   File "ui.py", line 87, in __call__

0104 13:49:37055 ::   File "ui.py", line 78, in __call__

0104 13:49:37055 ::   File "uibonustransfer.py", line 111, in OverInItem

0104 13:49:37056 :: KeyError
0104 13:49:37056 :: :
0104 13:49:37056 :: 403
0104 13:49:37056 ::

0104 13:49:37222 :: Traceback (most recent call last):

0104 13:49:37222 ::   File "ui.py", line 1485, in OnOverInItem

0104 13:49:37223 ::   File "ui.py", line 87, in __call__

0104 13:49:37223 ::   File "ui.py", line 78, in __call__

0104 13:49:37223 ::   File "uibonustransfer.py", line 111, in OverInItem

0104 13:49:37223 :: KeyError
0104 13:49:37223 :: :
0104 13:49:37223 :: 403
0104 13:49:37223 ::

0104 13:49:37506 :: Traceback (most recent call last):

0104 13:49:37506 ::   File "ui.py", line 1485, in OnOverInItem

0104 13:49:37506 ::   File "ui.py", line 87, in __call__

0104 13:49:37506 ::   File "ui.py", line 78, in __call__

0104 13:49:37506 ::   File "uibonustransfer.py", line 111, in OverInItem

And the part with porblem is this

Spoiler

import ui
import player
import event
import uiToolTip
import exception
import item
import uiCommon
import mouseModule
import chat
import net

class BonusTransfer(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.buttons, self.grids, self.costumes = {}, {}, {300 : {},303 : {},}
        self.__Load()

        self.tooltipItem = uiToolTip.ItemToolTip()
        self.tooltipItem.Hide()
        
    def __del__(self):
        ui.ScriptWindow.__del__(self)
        self.Close()

    def __Load_LoadScript(self, fileName):
        try:
            pyScriptLoader = ui.PythonScriptLoader()
            pyScriptLoader.LoadScriptFile(self, fileName)
        except:
            import exception
            exception.Abort("BonusTransfer.__Load_LoadScript")

    def __Load_BindObject(self):
        try:
            self.titleBar = self.GetChild("TitleBar")
            self.grids[300] = self.GetChild("Costume1")
            self.grids[303] = self.GetChild("Costume2")
            self.grids[2] = self.GetChild("Costume3")
            self.grids[3] = self.GetChild("Item")
            self.buttons[0] = self.GetChild("Button1")
            self.buttons[1] = self.GetChild("Button2")
        except:
            import exception
            exception.Abort("BonusTransfer.__Load_BindObject")
            
        self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
        self.grids[300].SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
        self.grids[300].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))    
        self.grids[300].SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
        self.grids[300].SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
        self.grids[303].SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
        self.grids[303].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))    
        self.grids[303].SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
        self.grids[303].SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
        self.grids[2].SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
        self.grids[2].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
        self.grids[3].SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
        self.grids[3].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))    
        self.grids[3].SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
        self.grids[3].SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))                
        self.buttons[0].SetEvent(self.TransferDialog)
        self.buttons[1].SetEvent(self.Close)

    def __Load(self):
        self.__Load_LoadScript("uiscript/bonustransfer.py")
        self.__Load_BindObject()
            
    def OnPressEscapeKey(self):
        self.Close()
        return TRUE
        
    def Shows(self):
        ui.ScriptWindow.Show(self)

    def Close(self):
        self.Hide()
        return TRUE        
    
    def TransferDialog(self):
        self.ConfirmEkran = uiCommon.QuestionDialog()
        self.ConfirmEkran.SetText("Kostüm bonusu aktarilsin mi ?")
        self.ConfirmEkran.SetAcceptEvent(self.Transfer)
        self.ConfirmEkran.SetCancelEvent(self.NoTransfer)
        self.ConfirmEkran.Open()

    def Transfer(self):
        self.ConfirmEkran.Close()
        if self.costumes[300][0] is None or self.costumes[303][0] is None:
            return
        self.grids[3].ClearSlot(3)
        self.grids[3].RefreshSlot()
        self.grids[303].ClearSlot(303)
        self.grids[303].RefreshSlot()
        net.SendChatPacket("/costume_bonus_transfer "+str(self.costumes[300][0])+" "+str(self.costumes[303][0]))
        self.Close()
        
    def NoTransfer(self):
        self.ConfirmEkran.Close()

    def OverInItem(self, index):
        target = 303
        if index == 400:
            itemVnum = player.GetItemIndex(self.costumes[300][0])
            if self.costumes[303][0] is None:
                target = 300
            stones = [player.GetItemMetinSocket(self.costumes[target][0], i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]    
            attr = [player.GetItemAttribute(self.costumes[target][0], i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
            self.tooltipItem.SetControledToolTip(itemVnum, stones, attr)
        else:
            if self.costumes[index] is None:
                return
            self.tooltipItem.SetInventoryItem(self.costumes[index][0])
        
    def OverOutItem(self):
        if self.tooltipItem:
            self.tooltipItem.HideToolTip()
            
    def SelectEmptySlot(self, selectedSlotPos):
        if mouseModule.mouseController.isAttached():
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            itemVnum = player.GetItemIndex(attachedSlotPos)
            itemCount = player.GetItemCount(attachedSlotPos)
            item.SelectItem(itemVnum)
            itemType = item.GetItemType()    
            itemSubType = item.GetItemSubType()            
            if selectedSlotPos == 301:
                selectedSlotPos = 300
            if selectedSlotPos == 304:
                selectedSlotPos = 303
            if selectedSlotPos == 403:
                if itemVnum == 30027: # costume bonus transfer item kod
                    self.grids[3].SetItemSlot(403, itemVnum, itemCount)    
                else:
                    return
                    mouseModule.mouseController.DeattachObject()                
            if player.SLOT_TYPE_INVENTORY == attachedSlotType:
                if itemType != item.ITEM_TYPE_COSTUME:
                    mouseModule.mouseController.DeattachObject()
                    return
                elif itemType == item.ITEM_TYPE_COSTUME and itemSubType == 0:
                    pass                
                if attachedSlotPos in self.costumes:
                    mouseModule.mouseController.DeattachObject()                
                    return
                self.grids[selectedSlotPos].SetItemSlot(selectedSlotPos, itemVnum)
                self.grids[selectedSlotPos].RefreshSlot()
                self.costumes[selectedSlotPos][0] = attachedSlotPos
                if selectedSlotPos == 300:
                    self.grids[2].SetItemSlot(400, itemVnum)
                        
            mouseModule.mouseController.DeattachObject()    
            self.OverOutItem()

    def UnselectItemSlot(self, selectedSlotPos):
        isAttached = mouseModule.mouseController.isAttached()
        if not isAttached:
            self.costumes[selectedSlotPos][0] = 0
            self.grids[selectedSlotPos].ClearSlot(selectedSlotPos)
            self.grids[selectedSlotPos].RefreshSlot()
        if selectedSlotPos == 300:
            self.grids[2].ClearSlot(400)
            self.grids[2].RefreshSlot()    

 

And this:

Spoiler

window = {
    "name" : "Bonusessssssss",
    "style" : ("movable", "float",),    
    "x":(SCREEN_WIDTH - 188+8+8) / 2,
    "y":(SCREEN_HEIGHT - 335) / 2,    
    "width" : 188+8+8,
    "height" : 335+42,
    
    "children" :
    (
        {
            "name" : "Board",
            "type" : "board",
            "style" : ("attach",),

            "x" : 0,
            "y" : 0,

            "width" : 188+8+8,
            "height" : 335+42,

            "children" :
            (    
                {
                    "name" : "TitleBar",
                    "type" : "titlebar",
                    "style" : ("attach",),
                    "x" : 8,
                    "y" : 8,
                    "width" : 188+8+8-16,
                    "color" : "gray",
                    "children" :
                    (
                        {
                            "name":"TitleName",
                            "type":"text",
                            "x":0,
                            "y":4,
                            "text" : "Bonus Transfer",
                            "horizontal_align":"center",
                            "text_horizontal_align":"center"
                        },
                    ),
                },
                {
                    "name" : "Background",
                    "type" : "image",
                    "x" : 8,
                    "y" : 28,
                    "image" : "d:/ymir work/dinos/comb1.tga",
                    "children" :
                    (
                        {
                            "name" : "Costume1",
                            "type" : "grid_table",
                            "x" : 28,
                            "y" : 67,
                            "x_count" : 1,
                            "y_count" : 3,
                            "x_step" : 32,
                            "y_step" : 32,
                            "start_index" : 300,
                        },
                        {
                            "name" : "Costume2",
                            "type" : "grid_table",
                            "x" : 128,
                            "y" : 67,
                            "x_count" : 1,
                            "y_count" : 3,
                            "x_step" : 32,
                            "y_step" : 32,
                            "start_index" : 303,            
                        },
                        {
                            "name" : "Costume3",
                            "type" : "grid_table",
                            "x" : 80,
                            "y" : 185,
                            "x_count" : 1,
                            "y_count" : 3,
                            "x_step" : 32,
                            "y_step" : 32,
                            "start_index" : 400,            
                        },    
                        {
                            "name" : "Item",
                            "type" : "grid_table",
                            "x" : 80,
                            "y" : 14,
                            "x_count" : 1,
                            "y_count" : 1,
                            "x_step" : 32,
                            "y_step" : 32,
                            "start_index" : 403,            
                        },                        
                    ),
                },
                        
                {
                    "name" : "Button1",
                    "type" : "button",
                    "x" : 34,
                    "y" : 342,            
                    "text" : "Aktar",
                    "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
                    "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
                    "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
                },
                {
                    "name" : "Button2",
                    "type" : "button",
                    "x" : 34+70,
                    "y" : 342,            
                    "text" : "Iptal",
                    "default_image" : "d:/ymir work/ui/public/middle_button_01.sub",
                    "over_image" : "d:/ymir work/ui/public/middle_button_02.sub",
                    "down_image" : "d:/ymir work/ui/public/middle_button_03.sub",
                },
            ),
        },
    ),
}

 

Link to comment
Share on other sites

  • 1 month later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.