Çözüldü invalid syntax (uiPrivateShopBuilder.py, line 92)

  • Konuyu açan Konuyu açan lmaohw
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 7
  • Gösterim Gösterim 158
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

lmaohw

Premium Üye
Premium Üye
MT Üye
Mesaj
187
Çözümler
11
Beğeni
65
Puan
474
Ticaret Puanı
0
sysser:
Genişlet Daralt Kopyala
0527 14:14:06408 ::
networkModule.py(line:208) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:30) <module>
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:12) <module>
system.py(line:130) __pack_import
system.py(line:110) _process_result
uiInventory.py(line:16) <module>
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - <type 'exceptions.SyntaxError'>:invalid syntax (uiPrivateShopBuilder.py, line 92)

0527 14:14:06408 :: ============================================================================================================
0527 14:14:06408 :: Abort!!!!

uiprivateshopbuilder.py:
Genişlet Daralt Kopyala
import ui
import snd
import shop
import mouseModule
import player
import chr
import net
import uiCommon
import localeInfo
import chat
import item
import systemSetting #±èÁØÈ£
import player #±èÁØÈ£
import os


##### DISABLE/ENABLE SHOP VISIT COLOR ###
SHOP_VISIT=True
##### SHOP VISIT COLOR #####
SHOP_VISIT_COLOR=0xFF00C8FF
###########################
g_isBuildingPrivateShop = False

g_itemPriceDict={}

g_privateShopAdvertisementBoardDict={}

SHOP_RANGE=False
def GetShopNamesRange():
    global SHOP_RANGE
    if not SHOP_RANGE:
        return LoadShopNamesRange()
    return SHOP_RANGE

def LoadShopNamesRange():
    global SHOP_RANGE
    try:
        with open("shop.cfg", 'r') as f:
            SHOP_RANGE=float(f.read().replace('\n', ''))
    except IOError:
        SHOP_RANGE = 1.000
    return SHOP_RANGE

def SetShopNamesRange(pos):
    with open("shop.cfg", 'w+') as f:
        f.write(str(pos))
        f.close()
    LoadShopNamesRange()

def Clear():
    global g_itemPriceDict
    global g_isBuildingPrivateShop
    g_itemPriceDict={}
    g_isBuildingPrivateShop = False

def IsPrivateShopItemPriceList():
    global g_itemPriceDict
    if g_itemPriceDict:
        return True
    else:
        return False

def IsBuildingPrivateShop():
    global g_isBuildingPrivateShop
    if player.IsOpenPrivateShop() or g_isBuildingPrivateShop:
        return True
    else:
        return False

def SetPrivateShopItemPrice(itemVNum, itemPrice):
    global g_itemPriceDict
    g_itemPriceDict[int(itemVNum)]=itemPrice
    
def GetPrivateShopItemPrice(itemVNum):
    try:
        global g_itemPriceDict
        return g_itemPriceDict[itemVNum]
    except KeyError:
        return 0
        
def UpdateADBoard():   
    for key in g_privateShopAdvertisementBoardDict.keys():
        g_privateShopAdvertisementBoardDict[key].Show()
        
def DeleteADBoard(vid):
    if not g_privateShopAdvertisementBoardDict.has_key(vid):
        return
            
    del g_privateShopAdvertisementBoardDict[vid]
        

OnMouseLeftButtonUp(self):
        if not self.vid:
            return
        net.SendOnClickPacket(self.vid)
        if self.vid != player.GetMainCharacterIndex():
            self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR)
            self.shopAdvertismentBoardSeen.append(self.vid)
        return True
        
    def OnUpdate(self):
        if not self.vid:
        class PrivateShopAdvertisementBoard(ui.ThinBoard):
    def __init__(self):
        ui.ThinBoard.__init__(self, "UI_BOTTOM")
        self.vid = None
        self.__MakeTextLine()

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

    def __MakeTextLine(self):
        self.textLine = ui.TextLine()
        self.textLine.SetParent(self)
        self.textLine.SetWindowHorizontalAlignCenter()
        self.textLine.SetWindowVerticalAlignCenter()
        self.textLine.SetHorizontalAlignCenter()
        self.textLine.SetVerticalAlignCenter()
        self.textLine.Show()

    def Open(self, vid, text):
        self.vid = vid

        self.textLine.SetText(text)
        self.textLine.UpdateRect()
        self.SetSize(len(text)*6 + 10*2, 20)
        self.Show()
                
        g_privateShopAdvertisementBoardDict[vid] = self
        
    def     self.Hide()
            return   
        if systemSetting.IsShowSalesText():
        
            if chr.GetInstanceType(self.vid) not in [chr.INSTANCE_TYPE_PLAYER,chr.INSTANCE_TYPE_NPC]:
                self.Hide()
            if GetShopNamesRange() == 1.000:
                self.Show()
                (x, y) = chr.GetProjectPosition(self.vid, 220)
                self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
            else:
                LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange())
                (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid)
                (my_x, my_y, my_z) = player.GetMainCharacterPosition()
                if abs(my_x - to_x) <= LIMIT_RANGE and abs(my_y - to_y) <= LIMIT_RANGE:
                    (x, y) = chr.GetProjectPosition(self.vid, 220)
                    self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
                    self.Show()
                else:
                    self.Hide()
                    self.SetPosition(-10000, 0)
        else:
            for key in g_privateShopAdvertisementBoardDict.keys():
                if player.GetMainCharacterIndex() == key:
                    g_privateShopAdvertisementBoardDict[key].Show()
                    x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220)
                    g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
                else:
                    g_privateShopAdvertisementBoardDict[key].Hide()

class PrivateShopBuilder(ui.ScriptWindow):

    def __init__(self):
        #print "NEW MAKE_PRIVATE_SHOP_WINDOW ----------------------------------------------------------------"
        ui.ScriptWindow.__init__(self)

        self.__LoadWindow()
        self.itemStock = {}
        self.tooltipItem = None
        self.priceInputBoard = None
        self.days = 0
        self.title = ""

    def __del__(self):
        #print "------------------------------------------------------------- DELETE MAKE_PRIVATE_SHOP_WINDOW"
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/PrivateShopBuilder.py")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.LoadObject")

        try:
            GetObject = self.GetChild
            self.nameLine = GetObject("NameLine")
            self.itemSlot = GetObject("ItemSlot")
            self.btnOk = GetObject("OkButton")
            self.btnClose = GetObject("CloseButton")
            self.titleBar = GetObject("TitleBar")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.BindObject")

        self.btnOk.SetEvent(ui.__mem_func__(self.OnOk))
        self.btnClose.SetEvent(ui.__mem_func__(self.OnClose))
        self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))

        self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
        self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
        self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
        self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))

    def Destroy(self):
        self.ClearDictionary()

        self.nameLine = None
        self.itemSlot = None
        self.btnOk = None
        self.btnClose = None
        self.titleBar = None
        self.priceInputBoard = None

    def Open(self, title,days):

        self.days = days
        self.title = title

        if len(title) > 25:
            title = title[:22] + "..."

        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.nameLine.SetText(title)
        self.SetCenterPosition()
        self.Refresh()
        self.Show()

        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = True

    def Close(self):
        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = False

        self.title = ""
        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.Hide()

    def SetItemToolTip(self, tooltipItem):
        self.tooltipItem = tooltipItem

    def Refresh(self):
        getitemVNum=player.GetItemIndex
        getItemCount=player.GetItemCount
        setitemVNum=self.itemSlot.SetItemSlot
        delItem=self.itemSlot.ClearSlot

        for i in xrange(shop.SHOP_SLOT_COUNT):

            if not self.itemStock.has_key(i):
                delItem(i)
                continue

            pos = self.itemStock[i]

            itemCount = getItemCount(*pos)
            if itemCount <= 1:
                itemCount = 0
            setitemVNum(i, getitemVNum(*pos), itemCount)

        self.itemSlot.RefreshSlot()

    def ReadFilePrice(self,vnum,count):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        oldPrice=0
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        if os.path.exists(n):
            fd = open( n,'r')
            oldPrice=int(fd.readlines()[0])
            
        return oldPrice
    def SaveFilePrice(self,vnum,count,price):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        f = file(n, "w+")
        f.write(str(price))
        f.close()

    def OnSelectEmptySlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            mouseModule.mouseController.DeattachObject()

            if player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType:
                return
            attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
            count = player.GetItemCount(attachedInvenType, attachedSlotPos)
                
            itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
            item.SelectItem(itemVNum)

            
            
            if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.PRIVATE_SHOP_CANNOT_SELL_ITEM)
                return
            
            priceInputBoard = uiCommon.MoneyInputDialog()

            priceInputBoard.SetTitle(localeInfo.PRIVATE_SHOP_INPUT_PRICE_DIALOG_TITLE)
            priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
            priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
            priceInputBoard.SetMaxLength(16)
            priceInputBoard.Open()

            itemPrice=self.ReadFilePrice(itemVNum,count)

            if itemPrice>0:
                priceInputBoard.SetValue(itemPrice)
            
            self.priceInputBoard = priceInputBoard
            self.priceInputBoard.itemVNum = itemVNum
            self.priceInputBoard.sourceWindowType = attachedInvenType
            self.priceInputBoard.sourceSlotPos = attachedSlotPos
            self.priceInputBoard.targetSlotPos = selectedSlotPos

    def OnSelectItemSlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            snd.PlaySound("sound/ui/loginfail.wav")
            mouseModule.mouseController.DeattachObject()

        else:
            if not selectedSlotPos in self.itemStock:
                return

            invenType, invenPos = self.itemStock[selectedSlotPos]
            shop.DelPrivateShopItemStock(invenType, invenPos)
            snd.PlaySound("sound/ui/drop.wav")

            del self.itemStock[selectedSlotPos]

            self.Refresh()

    def AcceptInputPrice(self):

        if not self.priceInputBoard:
            return True

        text = self.priceInputBoard.GetText()
        if text and int(text) >= 2000000001:
            chat.AppendChat(1, "Maksimum kullanabileceğiniz Yang miktarı 2.000.000.000'dir.")
            return TRUE

        if not text:
            return True

        if not text.isdigit():
            return True

        if int(text) <= 0:
            return True
        
        attachedInvenType = self.priceInputBoard.sourceWindowType
        sourceSlotPos = self.priceInputBoard.sourceSlotPos
        targetSlotPos = self.priceInputBoard.targetSlotPos

        for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items():
            if itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos:
                shop.DelPrivateShopItemStock(itemWindowType, itemSlotIndex)
                del self.itemStock[privatePos]

        price = int(self.priceInputBoard.GetText())

        if IsPrivateShopItemPriceList():
            SetPrivateShopItemPrice(self.priceInputBoard.itemVNum, price)
    
        shop.AddPrivateShopItemStock(attachedInvenType, sourceSlotPos, targetSlotPos, price)
        count = player.GetItemCount(attachedInvenType, sourceSlotPos)
        vnum = player.GetItemIndex(attachedInvenType, sourceSlotPos)
        self.SaveFilePrice(vnum,count,price)
        self.itemStock[targetSlotPos] = (attachedInvenType, sourceSlotPos)
        snd.PlaySound("sound/ui/drop.wav")

        self.Refresh()       

        #####

        self.priceInputBoard = None
        return True

    def CancelInputPrice(self):
        self.priceInputBoard = None
        return True

    def OnOk(self):

        if not self.title:
            return

        if 0 == len(self.itemStock):
            return

        shop.BuildPrivateShop(self.title,self.days)
        self.Close()

    def OnClose(self):
        self.Close()

    def OnPressEscapeKey(self):
        self.Close()
        return True

    def OnOverInItem(self, slotIndex):

        if self.tooltipItem:
            if self.itemStock.has_key(slotIndex):
                self.tooltipItem.SetPrivateShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,))

    def OnOverOutItem(self):
        if self.tooltipItem:
            self.tooltipItem.HideToolTip()
 
sysser:
Genişlet Daralt Kopyala
0527 14:14:06408 ::
networkModule.py(line:208) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:30) <module>
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:12) <module>
system.py(line:130) __pack_import
system.py(line:110) _process_result
uiInventory.py(line:16) <module>
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - <type 'exceptions.SyntaxError'>:invalid syntax (uiPrivateShopBuilder.py, line 92)

0527 14:14:06408 :: ============================================================================================================
0527 14:14:06408 :: Abort!!!!

uiprivateshopbuilder.py:
Genişlet Daralt Kopyala
import ui
import snd
import shop
import mouseModule
import player
import chr
import net
import uiCommon
import localeInfo
import chat
import item
import systemSetting #±èÁØÈ£
import player #±èÁØÈ£
import os


##### DISABLE/ENABLE SHOP VISIT COLOR ###
SHOP_VISIT=True
##### SHOP VISIT COLOR #####
SHOP_VISIT_COLOR=0xFF00C8FF
###########################
g_isBuildingPrivateShop = False

g_itemPriceDict={}

g_privateShopAdvertisementBoardDict={}

SHOP_RANGE=False
def GetShopNamesRange():
    global SHOP_RANGE
    if not SHOP_RANGE:
        return LoadShopNamesRange()
    return SHOP_RANGE

def LoadShopNamesRange():
    global SHOP_RANGE
    try:
        with open("shop.cfg", 'r') as f:
            SHOP_RANGE=float(f.read().replace('\n', ''))
    except IOError:
        SHOP_RANGE = 1.000
    return SHOP_RANGE

def SetShopNamesRange(pos):
    with open("shop.cfg", 'w+') as f:
        f.write(str(pos))
        f.close()
    LoadShopNamesRange()

def Clear():
    global g_itemPriceDict
    global g_isBuildingPrivateShop
    g_itemPriceDict={}
    g_isBuildingPrivateShop = False

def IsPrivateShopItemPriceList():
    global g_itemPriceDict
    if g_itemPriceDict:
        return True
    else:
        return False

def IsBuildingPrivateShop():
    global g_isBuildingPrivateShop
    if player.IsOpenPrivateShop() or g_isBuildingPrivateShop:
        return True
    else:
        return False

def SetPrivateShopItemPrice(itemVNum, itemPrice):
    global g_itemPriceDict
    g_itemPriceDict[int(itemVNum)]=itemPrice
   
def GetPrivateShopItemPrice(itemVNum):
    try:
        global g_itemPriceDict
        return g_itemPriceDict[itemVNum]
    except KeyError:
        return 0
       
def UpdateADBoard():  
    for key in g_privateShopAdvertisementBoardDict.keys():
        g_privateShopAdvertisementBoardDict[key].Show()
       
def DeleteADBoard(vid):
    if not g_privateShopAdvertisementBoardDict.has_key(vid):
        return
           
    del g_privateShopAdvertisementBoardDict[vid]
       

OnMouseLeftButtonUp(self):
        if not self.vid:
            return
        net.SendOnClickPacket(self.vid)
        if self.vid != player.GetMainCharacterIndex():
            self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR)
            self.shopAdvertismentBoardSeen.append(self.vid)
        return True
       
    def OnUpdate(self):
        if not self.vid:
        class PrivateShopAdvertisementBoard(ui.ThinBoard):
    def __init__(self):
        ui.ThinBoard.__init__(self, "UI_BOTTOM")
        self.vid = None
        self.__MakeTextLine()

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

    def __MakeTextLine(self):
        self.textLine = ui.TextLine()
        self.textLine.SetParent(self)
        self.textLine.SetWindowHorizontalAlignCenter()
        self.textLine.SetWindowVerticalAlignCenter()
        self.textLine.SetHorizontalAlignCenter()
        self.textLine.SetVerticalAlignCenter()
        self.textLine.Show()

    def Open(self, vid, text):
        self.vid = vid

        self.textLine.SetText(text)
        self.textLine.UpdateRect()
        self.SetSize(len(text)*6 + 10*2, 20)
        self.Show()
               
        g_privateShopAdvertisementBoardDict[vid] = self
       
    def     self.Hide()
            return  
        if systemSetting.IsShowSalesText():
       
            if chr.GetInstanceType(self.vid) not in [chr.INSTANCE_TYPE_PLAYER,chr.INSTANCE_TYPE_NPC]:
                self.Hide()
            if GetShopNamesRange() == 1.000:
                self.Show()
                (x, y) = chr.GetProjectPosition(self.vid, 220)
                self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
            else:
                LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange())
                (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid)
                (my_x, my_y, my_z) = player.GetMainCharacterPosition()
                if abs(my_x - to_x) <= LIMIT_RANGE and abs(my_y - to_y) <= LIMIT_RANGE:
                    (x, y) = chr.GetProjectPosition(self.vid, 220)
                    self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
                    self.Show()
                else:
                    self.Hide()
                    self.SetPosition(-10000, 0)
        else:
            for key in g_privateShopAdvertisementBoardDict.keys():
                if player.GetMainCharacterIndex() == key:
                    g_privateShopAdvertisementBoardDict[key].Show()
                    x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220)
                    g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
                else:
                    g_privateShopAdvertisementBoardDict[key].Hide()

class PrivateShopBuilder(ui.ScriptWindow):

    def __init__(self):
        #print "NEW MAKE_PRIVATE_SHOP_WINDOW ----------------------------------------------------------------"
        ui.ScriptWindow.__init__(self)

        self.__LoadWindow()
        self.itemStock = {}
        self.tooltipItem = None
        self.priceInputBoard = None
        self.days = 0
        self.title = ""

    def __del__(self):
        #print "------------------------------------------------------------- DELETE MAKE_PRIVATE_SHOP_WINDOW"
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/PrivateShopBuilder.py")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.LoadObject")

        try:
            GetObject = self.GetChild
            self.nameLine = GetObject("NameLine")
            self.itemSlot = GetObject("ItemSlot")
            self.btnOk = GetObject("OkButton")
            self.btnClose = GetObject("CloseButton")
            self.titleBar = GetObject("TitleBar")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.BindObject")

        self.btnOk.SetEvent(ui.__mem_func__(self.OnOk))
        self.btnClose.SetEvent(ui.__mem_func__(self.OnClose))
        self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))

        self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
        self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
        self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
        self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))

    def Destroy(self):
        self.ClearDictionary()

        self.nameLine = None
        self.itemSlot = None
        self.btnOk = None
        self.btnClose = None
        self.titleBar = None
        self.priceInputBoard = None

    def Open(self, title,days):

        self.days = days
        self.title = title

        if len(title) > 25:
            title = title[:22] + "..."

        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.nameLine.SetText(title)
        self.SetCenterPosition()
        self.Refresh()
        self.Show()

        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = True

    def Close(self):
        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = False

        self.title = ""
        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.Hide()

    def SetItemToolTip(self, tooltipItem):
        self.tooltipItem = tooltipItem

    def Refresh(self):
        getitemVNum=player.GetItemIndex
        getItemCount=player.GetItemCount
        setitemVNum=self.itemSlot.SetItemSlot
        delItem=self.itemSlot.ClearSlot

        for i in xrange(shop.SHOP_SLOT_COUNT):

            if not self.itemStock.has_key(i):
                delItem(i)
                continue

            pos = self.itemStock[i]

            itemCount = getItemCount(*pos)
            if itemCount <= 1:
                itemCount = 0
            setitemVNum(i, getitemVNum(*pos), itemCount)

        self.itemSlot.RefreshSlot()

    def ReadFilePrice(self,vnum,count):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        oldPrice=0
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        if os.path.exists(n):
            fd = open( n,'r')
            oldPrice=int(fd.readlines()[0])
           
        return oldPrice
    def SaveFilePrice(self,vnum,count,price):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        f = file(n, "w+")
        f.write(str(price))
        f.close()

    def OnSelectEmptySlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            mouseModule.mouseController.DeattachObject()

            if player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType:
                return
            attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
            count = player.GetItemCount(attachedInvenType, attachedSlotPos)
               
            itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
            item.SelectItem(itemVNum)

           
           
            if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.PRIVATE_SHOP_CANNOT_SELL_ITEM)
                return
           
            priceInputBoard = uiCommon.MoneyInputDialog()

            priceInputBoard.SetTitle(localeInfo.PRIVATE_SHOP_INPUT_PRICE_DIALOG_TITLE)
            priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
            priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
            priceInputBoard.SetMaxLength(16)
            priceInputBoard.Open()

            itemPrice=self.ReadFilePrice(itemVNum,count)

            if itemPrice>0:
                priceInputBoard.SetValue(itemPrice)
           
            self.priceInputBoard = priceInputBoard
            self.priceInputBoard.itemVNum = itemVNum
            self.priceInputBoard.sourceWindowType = attachedInvenType
            self.priceInputBoard.sourceSlotPos = attachedSlotPos
            self.priceInputBoard.targetSlotPos = selectedSlotPos

    def OnSelectItemSlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            snd.PlaySound("sound/ui/loginfail.wav")
            mouseModule.mouseController.DeattachObject()

        else:
            if not selectedSlotPos in self.itemStock:
                return

            invenType, invenPos = self.itemStock[selectedSlotPos]
            shop.DelPrivateShopItemStock(invenType, invenPos)
            snd.PlaySound("sound/ui/drop.wav")

            del self.itemStock[selectedSlotPos]

            self.Refresh()

    def AcceptInputPrice(self):

        if not self.priceInputBoard:
            return True

        text = self.priceInputBoard.GetText()
        if text and int(text) >= 2000000001:
            chat.AppendChat(1, "Maksimum kullanabileceğiniz Yang miktarı 2.000.000.000'dir.")
            return TRUE

        if not text:
            return True

        if not text.isdigit():
            return True

        if int(text) <= 0:
            return True
       
        attachedInvenType = self.priceInputBoard.sourceWindowType
        sourceSlotPos = self.priceInputBoard.sourceSlotPos
        targetSlotPos = self.priceInputBoard.targetSlotPos

        for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items():
            if itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos:
                shop.DelPrivateShopItemStock(itemWindowType, itemSlotIndex)
                del self.itemStock[privatePos]

        price = int(self.priceInputBoard.GetText())

        if IsPrivateShopItemPriceList():
            SetPrivateShopItemPrice(self.priceInputBoard.itemVNum, price)
   
        shop.AddPrivateShopItemStock(attachedInvenType, sourceSlotPos, targetSlotPos, price)
        count = player.GetItemCount(attachedInvenType, sourceSlotPos)
        vnum = player.GetItemIndex(attachedInvenType, sourceSlotPos)
        self.SaveFilePrice(vnum,count,price)
        self.itemStock[targetSlotPos] = (attachedInvenType, sourceSlotPos)
        snd.PlaySound("sound/ui/drop.wav")

        self.Refresh()      

        #####

        self.priceInputBoard = None
        return True

    def CancelInputPrice(self):
        self.priceInputBoard = None
        return True

    def OnOk(self):

        if not self.title:
            return

        if 0 == len(self.itemStock):
            return

        shop.BuildPrivateShop(self.title,self.days)
        self.Close()

    def OnClose(self):
        self.Close()

    def OnPressEscapeKey(self):
        self.Close()
        return True

    def OnOverInItem(self, slotIndex):

        if self.tooltipItem:
            if self.itemStock.has_key(slotIndex):
                self.tooltipItem.SetPrivateShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,))

    def OnOverOutItem(self):
        if self.tooltipItem:
            self.tooltipItem.HideToolTip()
92 deki kodun başına

def koy boşluk bırak diğer defler ile aynı hizaya getir
 
hatta şimdi farkettim sen oradaki classı felan silmişsin. eski dosyayı at bence. bu şekilde çalışmayabilir.
 
hatta şimdi farkettim sen oradaki classı felan silmişsin. eski dosyayı at bence. bu şekilde çalışmayabilir.
Bende yeni fark ettim hocam tekrar kontrol edip elimle yedekten alıp sıfırdan ekledim düzeldi sorun şuan ama şöyle bir sorun kaldı elimde sysserde

sysser:
Genişlet Daralt Kopyala
0527 14:38:15721 ::   File "uiPrivateShopBuilder.py", line 126, in OnMouseLeftButtonUp

0527 14:38:15721 :: AttributeError
0527 14:38:15722 :: :
0527 14:38:15722 :: 'PrivateShopAdvertisementBoard' object has no attribute 'shopAdvertismentBoardSeen'
0527 14:38:15722 ::

yeni dosya
uiprivateshopbuilder.py:
Genişlet Daralt Kopyala
import ui
import snd
import shop
import mouseModule
import player
import chr
import net
import uiCommon
import localeInfo
import chat
import item
import systemSetting #±èÁØÈ£
import player #±èÁØÈ£
import constInfo
import app
import os

##### DISABLE/ENABLE SHOP VISIT COLOR ###
SHOP_VISIT=True
##### SHOP VISIT COLOR #####
SHOP_VISIT_COLOR=0xFF00C8FF
###########################
g_isBuildingPrivateShop = False

g_itemPriceDict={}

g_privateShopAdvertisementBoardDict={}
SHOP_RANGE=False
def GetShopNamesRange():
    global SHOP_RANGE
    if not SHOP_RANGE:
        return LoadShopNamesRange()
    return SHOP_RANGE

def LoadShopNamesRange():
    global SHOP_RANGE
    try:
        with open("shop.cfg", 'r') as f:
            SHOP_RANGE=float(f.read().replace('\n', ''))
    except IOError:
        SHOP_RANGE = 1.000
    return SHOP_RANGE

def SetShopNamesRange(pos):
    with open("shop.cfg", 'w+') as f:
        f.write(str(pos))
        f.close()
    LoadShopNamesRange()

def Clear():
    global g_itemPriceDict
    global g_isBuildingPrivateShop
    g_itemPriceDict={}
    g_isBuildingPrivateShop = False

def IsPrivateShopItemPriceList():
    global g_itemPriceDict
    if g_itemPriceDict:
        return True
    else:
        return False

def IsBuildingPrivateShop():
    global g_isBuildingPrivateShop
    if player.IsOpenPrivateShop() or g_isBuildingPrivateShop:
        return True
    else:
        return False

def SetPrivateShopItemPrice(itemVNum, itemPrice):
    global g_itemPriceDict
    g_itemPriceDict[int(itemVNum)]=itemPrice
    
def GetPrivateShopItemPrice(itemVNum):
    try:
        global g_itemPriceDict
        return g_itemPriceDict[itemVNum]
    except KeyError:
        return 0
        
def UpdateADBoard():   
    for key in g_privateShopAdvertisementBoardDict.keys():
        g_privateShopAdvertisementBoardDict[key].Show()
        
def DeleteADBoard(vid):
    if not g_privateShopAdvertisementBoardDict.has_key(vid):
        return
            
    del g_privateShopAdvertisementBoardDict[vid]
        

class PrivateShopAdvertisementBoard(ui.ThinBoard):
    def __init__(self):
        ui.ThinBoard.__init__(self, "UI_BOTTOM")
        self.vid = None
        self.__MakeTextLine()

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

    def __MakeTextLine(self):
        self.textLine = ui.TextLine()
        self.textLine.SetParent(self)
        self.textLine.SetWindowHorizontalAlignCenter()
        self.textLine.SetWindowVerticalAlignCenter()
        self.textLine.SetHorizontalAlignCenter()
        self.textLine.SetVerticalAlignCenter()
        self.textLine.Show()

    def Open(self, vid, text):
        self.vid = vid

        self.textLine.SetText(text)
        self.textLine.UpdateRect()
        self.SetSize(len(text)*6 + 10*2, 20)
        self.Show()
                
        g_privateShopAdvertisementBoardDict[vid] = self
        
    def OnMouseLeftButtonUp(self):
        if not self.vid:
            return
        net.SendOnClickPacket(self.vid)
        if self.vid != player.GetMainCharacterIndex():
            self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR)
            self.shopAdvertismentBoardSeen.append(self.vid)
        return True
        
    def OnUpdate(self):
        if not self.vid:
            self.Hide()
            return   
        if systemSetting.IsShowSalesText():
        
            if chr.GetInstanceType(self.vid) not in [chr.INSTANCE_TYPE_PLAYER,chr.INSTANCE_TYPE_NPC]:
                self.Hide()
            if GetShopNamesRange() == 1.000:
                self.Show()
                (x, y) = chr.GetProjectPosition(self.vid, 220)
                self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
            else:
                LIMIT_RANGE = abs(constInfo.SHOPNAMES_RANGE * GetShopNamesRange())
                (to_x, to_y, to_z) = chr.GetPixelPosition(self.vid)
                (my_x, my_y, my_z) = player.GetMainCharacterPosition()
                if abs(my_x - to_x) <= LIMIT_RANGE and abs(my_y - to_y) <= LIMIT_RANGE:
                    (x, y) = chr.GetProjectPosition(self.vid, 220)
                    self.SetPosition(x - self.GetWidth() / 2, y - self.GetHeight() / 2)
                    self.Show()
                else:
                    self.Hide()
                    self.SetPosition(-10000, 0)
        else:
            for key in g_privateShopAdvertisementBoardDict.keys():
                if player.GetMainCharacterIndex() == key:
                    g_privateShopAdvertisementBoardDict[key].Show()
                    x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220)
                    g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
                else:
                    g_privateShopAdvertisementBoardDict[key].Hide()
    
class PrivateShopBuilder(ui.ScriptWindow):

    def __init__(self):
        #print "NEW MAKE_PRIVATE_SHOP_WINDOW ----------------------------------------------------------------"
        ui.ScriptWindow.__init__(self)

        self.__LoadWindow()
        self.itemStock = {}
        self.tooltipItem = None
        self.priceInputBoard = None
        self.days = 0
        self.title = ""

    def __del__(self):
        #print "------------------------------------------------------------- DELETE MAKE_PRIVATE_SHOP_WINDOW"
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/PrivateShopBuilder.py")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.LoadObject")

        try:
            GetObject = self.GetChild
            self.nameLine = GetObject("NameLine")
            self.itemSlot = GetObject("ItemSlot")
            self.btnOk = GetObject("OkButton")
            self.btnClose = GetObject("CloseButton")
            self.titleBar = GetObject("TitleBar")
        except:
            import exception
            exception.Abort("PrivateShopBuilderWindow.LoadWindow.BindObject")

        self.btnOk.SetEvent(ui.__mem_func__(self.OnOk))
        self.btnClose.SetEvent(ui.__mem_func__(self.OnClose))
        self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))

        self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
        self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
        self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
        self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))

    def Destroy(self):
        self.ClearDictionary()

        self.nameLine = None
        self.itemSlot = None
        self.btnOk = None
        self.btnClose = None
        self.titleBar = None
        self.priceInputBoard = None

    def Open(self, title,days):

        self.days = days
        self.title = title

        if len(title) > 25:
            title = title[:22] + "..."

        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.nameLine.SetText(title)
        self.SetCenterPosition()
        self.Refresh()
        self.Show()

        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = True

    def Close(self):
        global g_isBuildingPrivateShop
        g_isBuildingPrivateShop = False

        self.title = ""
        self.itemStock = {}
        shop.ClearPrivateShopStock()
        self.Hide()

    def SetItemToolTip(self, tooltipItem):
        self.tooltipItem = tooltipItem

    def Refresh(self):
        getitemVNum=player.GetItemIndex
        getItemCount=player.GetItemCount
        setitemVNum=self.itemSlot.SetItemSlot
        delItem=self.itemSlot.ClearSlot

        for i in xrange(shop.SHOP_SLOT_COUNT):

            if not self.itemStock.has_key(i):
                delItem(i)
                continue

            pos = self.itemStock[i]

            itemCount = getItemCount(*pos)
            if itemCount <= 1:
                itemCount = 0
            setitemVNum(i, getitemVNum(*pos), itemCount)

        self.itemSlot.RefreshSlot()

    def ReadFilePrice(self,vnum,count):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        oldPrice=0
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        if os.path.exists(n):
            fd = open( n,'r')
            oldPrice=int(fd.readlines()[0])
            
        return oldPrice
    def SaveFilePrice(self,vnum,count,price):
        d = "shops"
        if not os.path.exists(d):
            os.makedirs(d)
        n=d+"/"+str(vnum)+"_"+str(count)+".txt"
        f = file(n, "w+")
        f.write(str(price))
        f.close()

    def OnSelectEmptySlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            attachedSlotType = mouseModule.mouseController.GetAttachedType()
            attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
            mouseModule.mouseController.DeattachObject()

            if player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType:
                return
            attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
            count = player.GetItemCount(attachedInvenType, attachedSlotPos)
                
            itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
            item.SelectItem(itemVNum)

            
            
            if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.PRIVATE_SHOP_CANNOT_SELL_ITEM)
                return
            
            priceInputBoard = uiCommon.MoneyInputDialog()

            priceInputBoard.SetTitle(localeInfo.PRIVATE_SHOP_INPUT_PRICE_DIALOG_TITLE)
            priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
            priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
            priceInputBoard.SetMaxLength(16)
            priceInputBoard.Open()

            itemPrice=self.ReadFilePrice(itemVNum,count)

            if itemPrice>0:
                priceInputBoard.SetValue(itemPrice)
            
            self.priceInputBoard = priceInputBoard
            self.priceInputBoard.itemVNum = itemVNum
            self.priceInputBoard.sourceWindowType = attachedInvenType
            self.priceInputBoard.sourceSlotPos = attachedSlotPos
            self.priceInputBoard.targetSlotPos = selectedSlotPos

    def OnSelectItemSlot(self, selectedSlotPos):

        isAttached = mouseModule.mouseController.isAttached()
        if isAttached:
            snd.PlaySound("sound/ui/loginfail.wav")
            mouseModule.mouseController.DeattachObject()

        else:
            if not selectedSlotPos in self.itemStock:
                return

            invenType, invenPos = self.itemStock[selectedSlotPos]
            shop.DelPrivateShopItemStock(invenType, invenPos)
            snd.PlaySound("sound/ui/drop.wav")

            del self.itemStock[selectedSlotPos]

            self.Refresh()

    def AcceptInputPrice(self):

        if not self.priceInputBoard:
            return True

        text = self.priceInputBoard.GetText()

        if not text:
            return True

        if not text.isdigit():
            return True

        if int(text) <= 0:
            return True
        
        attachedInvenType = self.priceInputBoard.sourceWindowType
        sourceSlotPos = self.priceInputBoard.sourceSlotPos
        targetSlotPos = self.priceInputBoard.targetSlotPos

        for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items():
            if itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos:
                shop.DelPrivateShopItemStock(itemWindowType, itemSlotIndex)
                del self.itemStock[privatePos]

        price = int(self.priceInputBoard.GetText())

        if IsPrivateShopItemPriceList():
            SetPrivateShopItemPrice(self.priceInputBoard.itemVNum, price)
    
        shop.AddPrivateShopItemStock(attachedInvenType, sourceSlotPos, targetSlotPos, price)
        count = player.GetItemCount(attachedInvenType, sourceSlotPos)
        vnum = player.GetItemIndex(attachedInvenType, sourceSlotPos)
        self.SaveFilePrice(vnum,count,price)
        self.itemStock[targetSlotPos] = (attachedInvenType, sourceSlotPos)
        snd.PlaySound("sound/ui/drop.wav")

        self.Refresh()       

        #####

        self.priceInputBoard = None
        return True

    def CancelInputPrice(self):
        self.priceInputBoard = None
        return True

    def OnOk(self):

        if not self.title:
            return

        if 0 == len(self.itemStock):
            return

        shop.BuildPrivateShop(self.title,self.days)
        self.Close()

    def OnClose(self):
        self.Close()

    def OnPressEscapeKey(self):
        self.Close()
        return True

    def OnOverInItem(self, slotIndex):

        if self.tooltipItem:
            if self.itemStock.has_key(slotIndex):
                self.tooltipItem.SetPrivateShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,))

    def OnOverOutItem(self):
        if self.tooltipItem:
            self.tooltipItem.HideToolTip()
 
Son düzenleme:
Bende yeni fark ettim hocam tekrar kontrol edip elimle yedekten alıp sıfırdan ekledim düzeldi sorun şuan ama şöyle bir sorun kaldı elimde sysserde

sysser:
Genişlet Daralt Kopyala
0527 14:38:15721 ::   File "uiPrivateShopBuilder.py", line 126, in OnMouseLeftButtonUp

0527 14:38:15721 :: AttributeError
0527 14:38:15722 :: :
0527 14:38:15722 :: 'PrivateShopAdvertisementBoard' object has no attribute 'shopAdvertismentBoardSeen'
0527 14:38:15722 ::
güncel dosyanı paylaşır mısın bi bakayım
 
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Üst