Exemplo n.º 1
0
    def Open(self, vid):

        isPrivateShop = FALSE
        isMainPlayerPrivateShop = FALSE

        import chr
        if chr.IsNPC(vid):
            isPrivateShop = FALSE
        else:
            isPrivateShop = TRUE

        if player.IsMainCharacterIndex(vid):

            isMainPlayerPrivateShop = TRUE

            self.btnBuy.Hide()
            self.btnSell.Hide()
            self.btnClose.Show()

        else:

            isMainPlayerPrivateShop = FALSE

            self.btnBuy.Show()
            self.btnSell.Show()
            self.btnClose.Hide()

        shop.Open(isPrivateShop, isMainPlayerPrivateShop)

        self.tabIdx = 0

        if isPrivateShop:
            self.__HideMiddleTabs()
            self.__HideSmallTabs()
        else:
            if shop.GetTabCount() == 1:
                self.__ShowBuySellButton()
                self.__HideMiddleTabs()
                self.__HideSmallTabs()
            elif shop.GetTabCount() == 2:
                self.__HideBuySellButton()
                self.__ShowMiddleTabs()
                self.__HideSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(0)
            elif shop.GetTabCount() == 3:
                self.__HideBuySellButton()
                self.__HideMiddleTabs()
                self.__ShowSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(1)

        self.Refresh()
        self.SetTop()

        self.Show()

        (self.xShopStart, self.yShopStart,
         z) = player.GetMainCharacterPosition()
 def __SetTabNames(self):
     if shop.GetTabCount() == 2:
         self.middleRadioButtonGroup.SetText(0, shop.GetTabName(0))
         self.middleRadioButtonGroup.SetText(1, shop.GetTabName(1))
     elif shop.GetTabCount() == 3:
         self.smallRadioButtonGroup.SetText(0, shop.GetTabName(0))
         self.smallRadioButtonGroup.SetText(1, shop.GetTabName(1))
         self.smallRadioButtonGroup.SetText(2, shop.GetTabName(2))
Exemplo n.º 3
0
 def ScanShop(self, vid):
     self.numShopsSearched += 1
     chr.SelectInstance(vid)
     for x in range(0, self.SLOT_COUNT * shop.GetTabCount()):
         id = shop.GetItemID(x)
         if id != 0:
             price = shop.GetItemPrice(x)
             name = item.GetItemNameByVnum(id)
             if id == 50300:
                 sk = shop.GetItemMetinSocket(x, 0)
                 skill_name = str(skill.GetSkillName(sk))
                 name = str(skill_name) + " " + name
             count = shop.GetItemCount(x)
             it = self.Item(name, vid, count, price, x,
                            shop.GetItemCheque(x))
             self.Items.append(it)
     self.UpdateLabelText()
    def Open(self, vid, type=0):
        self.vid = int(vid)
        isPrivateShop = False
        isMainPlayerPrivateShop = False
        myshop = False
        for i in xrange(len(constInfo.MyShops)):
            if int(constInfo.MyShops[i]["vid"]) == int(self.vid):
                myshop = True
                self.vid = int(constInfo.MyShops[i]["id"])
        chr.SelectInstance(self.vid)
        if chr.GetRace() == 30000 or not chr.IsNPC(self.vid):
            isPrivateShop = True
        if player.IsMainCharacterIndex(self.vid):
            myshop = True
            self.vid = ""
        if myshop == True:
            isMainPlayerPrivateShop = True

            self.btnBuy.Hide()
            self.btnSell.Hide()
            self.btnClose.Show()

        else:

            isMainPlayerPrivateShop = False

            self.btnBuy.Show()
            self.btnSell.Show()
            self.btnClose.Hide()
        shop.Open(isPrivateShop, isMainPlayerPrivateShop)

        self.tabIdx = 0

        if isPrivateShop:
            self.__HideMiddleTabs()
            self.__HideSmallTabs()
        else:
            if shop.GetTabCount() == 1:
                self.__ShowBuySellButton()
                self.__HideMiddleTabs()
                self.__HideSmallTabs()
            elif shop.GetTabCount() == 2:
                self.__HideBuySellButton()
                self.__ShowMiddleTabs()
                self.__HideSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(0)
            elif shop.GetTabCount() == 3:
                self.__HideBuySellButton()
                self.__HideMiddleTabs()
                self.__ShowSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(1)

        self.Refresh()
        self.SetTop()

        self.Show()

        (self.xShopStart, self.yShopStart,
         z) = player.GetMainCharacterPosition()
Exemplo n.º 5
0
    def Open(self, vid):

        if constInfo.GUILDSTORAGE["open"] == 1:
            chat.AppendChat(
                chat.CHAT_TYPE_INFO,
                "Du kannst keinen Shop oeffnen, solange das Gildenlager offen ist."
            )
            self.Close()

        isPrivateShop = False
        isMainPlayerPrivateShop = False

        import chr
        if chr.IsNPC(vid):
            isPrivateShop = False
        else:
            isPrivateShop = True

        if fgGHGjjFHJghjfFG1545gGG.IsMainCharacterIndex(vid):

            isMainPlayerPrivateShop = True

            self.btnBuy.Hide()
            self.btnSell.Hide()
            self.btnClose.Show()

        else:

            isMainPlayerPrivateShop = False

            self.btnBuy.Show()
            self.btnSell.Show()
            self.btnClose.Hide()

        shop.Open(isPrivateShop, isMainPlayerPrivateShop)

        self.tabIdx = 0

        if isPrivateShop:
            self.__HideMiddleTabs()
            self.__HideSmallTabs()
        else:
            if shop.GetTabCount() == 1:
                self.__ShowBuySellButton()
                self.__HideMiddleTabs()
                self.__HideSmallTabs()
            elif shop.GetTabCount() == 2:
                self.__HideBuySellButton()
                self.__ShowMiddleTabs()
                self.__HideSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(0)
            elif shop.GetTabCount() == 3:
                self.__HideBuySellButton()
                self.__HideMiddleTabs()
                self.__ShowSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(1)

        self.Refresh()
        self.SetTop()

        self.Show()

        (self.xShopStart, self.yShopStart,
         z) = fgGHGjjFHJghjfFG1545gGG.GetMainCharacterPosition()
Exemplo n.º 6
0
        def Open(self, vid, owner_vid, grid_type):

            isPrivateShop = False
            isMainPlayerPrivateShop = False

            self.isMyShop = owner_vid > 0 and player.IsMainCharacterIndex(
                owner_vid)
            self.lastShopVID = vid

            if chr.IsNPC(vid) and owner_vid == 0:
                isPrivateShop = False
            else:
                isPrivateShop = True

            if isPrivateShop:
                self.GridSize = self.SizeToGridSize[grid_type]
            else:
                self.GridSize = 40

            for i in range(40, 90 + 10, 10):
                if self.itemSlotList["ItemSlot_%d" % i].IsShow():
                    self.itemSlotList["ItemSlot_%d" % i].Hide()

            self.SetSize(self.realWidth, self.realHeight)
            self.board.SetSize(self.realBoardWidth, self.realBoardHeight)
            self.titleBar.SetWidth(self.realTitleBarX)

            self.btnBuy.SetPosition(self.realBuyBtnX, self.realBuyBtnY)
            self.btnSell.SetPosition(self.realSellBtnX, self.realSellBtnY)
            self.btnMove.SetPosition(self.realMoveBtnX, self.realMoveBtnY)
            self.btnClose.SetPosition(self.realCloseBtnX, self.realCloseBtnY)
            self.wndMoneySlot.SetPosition(self.realMoneySlotX,
                                          self.realMoneySlotY)

            if self.btnBuy.IsShow(): self.btnBuy.Hide()
            if self.btnSell.IsShow(): self.btnSell.Hide()
            if self.btnMove.IsShow(): self.btnMove.Hide()
            if self.btnClose.IsShow(): self.btnClose.Hide()
            if self.wndMoneySlot.IsShow(): self.wndMoneySlot.Hide()

            self.itemSlotList["ItemSlot_%d" % self.GridSize].Show()
            self.itemSlotList["ItemSlot_%d" % self.GridSize].SetSlotStyle(
                wndMgr.SLOT_STYLE_NONE)
            self.itemSlotList["ItemSlot_%d" %
                              self.GridSize].SAFE_SetButtonEvent(
                                  "LEFT", "EMPTY", self.SelectEmptySlot)
            self.itemSlotList["ItemSlot_%d" %
                              self.GridSize].SAFE_SetButtonEvent(
                                  "LEFT", "EXIST", self.SelectItemSlot)
            self.itemSlotList["ItemSlot_%d" %
                              self.GridSize].SAFE_SetButtonEvent(
                                  "RIGHT", "EXIST", self.UnselectItemSlot)

            self.itemSlotList["ItemSlot_%d" %
                              self.GridSize].SetOverInItemEvent(
                                  ui.__mem_func__(self.OverInItem))
            self.itemSlotList["ItemSlot_%d" %
                              self.GridSize].SetOverOutItemEvent(
                                  ui.__mem_func__(self.OverOutItem))

            if player.IsMainCharacterIndex(vid) or self.isMyShop or (
                    chr.IsGameMaster(player.GetMainCharacterIndex())
                    and isPrivateShop):
                isMainPlayerPrivateShop = True

                self.btnBuy.Hide()
                self.btnSell.Hide()
                self.btnClose.Show()
                if self.isMyShop:
                    self.btnMove.Show()
                self.wndMoneySlot.Show()

                self.SetSize(self.width, self.height + 16)
                self.board.SetSize(self.width, self.height + 16)
                self.UpdateRect()
            else:

                isMainPlayerPrivateShop = False

                self.btnBuy.Show()
                self.btnSell.Show()
                self.btnClose.Hide()
                self.btnMove.Hide()
                self.wndMoneySlot.Hide()

                self.SetSize(self.width, self.height)
                self.board.SetSize(self.width, self.height)
                self.UpdateRect()

            shop.Open(isPrivateShop, isMainPlayerPrivateShop)

            self.tabIdx = 0

            heightDifference = 80
            widthDifferenceBase = 32
            btnDifference = 20
            gridSizeToWindowPos = grid_type - 1
            fixDifference = 14

            if self.GridSize >= 50:
                self.SetSize(
                    self.realWidth + widthDifferenceBase * gridSizeToWindowPos,
                    self.realHeight + heightDifference)
                self.board.SetSize(
                    self.realBoardWidth +
                    widthDifferenceBase * gridSizeToWindowPos,
                    self.realBoardHeight + heightDifference)
                if self.GridSize != 50:
                    self.titleBar.SetWidth(self.realTitleBarX +
                                           widthDifferenceBase *
                                           gridSizeToWindowPos)
                    self.wndMoneySlot.SetPosition(
                        self.realMoneySlotX * gridSizeToWindowPos,
                        self.realMoneySlotY + heightDifference - fixDifference)
                else:
                    self.wndMoneySlot.SetPosition(
                        self.realMoneySlotX,
                        self.realMoneySlotY + heightDifference - fixDifference)
                self.btnBuy.SetPosition(self.realBuyBtnX + btnDifference,
                                        self.realBuyBtnY + heightDifference)
                self.btnSell.SetPosition(self.realSellBtnX + btnDifference,
                                         self.realSellBtnY + heightDifference)
                self.btnMove.SetPosition(
                    self.realMoveBtnX + btnDifference - fixDifference,
                    self.realMoveBtnY + heightDifference - fixDifference)
                self.btnClose.SetPosition(
                    self.realCloseBtnX + btnDifference,
                    self.realCloseBtnY + heightDifference - fixDifference)

            #self.UpdateRect()
            if isPrivateShop:
                self.__HideMiddleTabs()
                self.__HideSmallTabs()
            else:
                if shop.GetTabCount() == 1:
                    self.__ShowBuySellButton()
                    self.__HideMiddleTabs()
                    self.__HideSmallTabs()
                elif shop.GetTabCount() == 2:
                    self.__HideBuySellButton()
                    self.__ShowMiddleTabs()
                    self.__HideSmallTabs()
                    self.__SetTabNames()
                    self.middleRadioButtonGroup.OnClick(0)
                elif shop.GetTabCount() == 3:
                    self.__HideBuySellButton()
                    self.__HideMiddleTabs()
                    self.__ShowSmallTabs()
                    self.__SetTabNames()
                    self.middleRadioButtonGroup.OnClick(1)

            self.Refresh()
            self.SetTop()

            self.Show()

            (self.xShopStart, self.yShopStart,
             z) = player.GetMainCharacterPosition()
Exemplo n.º 7
0
    def Open(self, vid):

        isPrivateShop = False
        isMainPlayerPrivateShop = False

        import chr
        if chr.IsNPC(vid):
            isPrivateShop = False
        else:
            isPrivateShop = True

        if player.IsMainCharacterIndex(vid):

            isMainPlayerPrivateShop = True

            self.btnBuy.Hide()
            self.btnSell.Hide()
            self.btnClose.Show()

        else:

            isMainPlayerPrivateShop = False

            self.btnBuy.Show()
            self.btnSell.Show()
            self.btnClose.Hide()

        shop.Open(isPrivateShop, isMainPlayerPrivateShop)

        self.tabIdx = 0

        if isPrivateShop:
            self.__HideMiddleTabs()
            self.__HideSmallTabs()
        else:
            if shop.GetTabCount() == 1:
                self.__ShowBuySellButton()
                self.__HideMiddleTabs()
                self.__HideSmallTabs()
            elif shop.GetTabCount() == 2:
                self.__HideBuySellButton()
                self.__ShowMiddleTabs()
                self.__HideSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(0)
            elif shop.GetTabCount() == 3:
                self.__HideBuySellButton()
                self.__HideMiddleTabs()
                self.__ShowSmallTabs()
                self.__SetTabNames()
                self.middleRadioButtonGroup.OnClick(1)

        self.Refresh()
        self.SetTop()

        self.Show()

        (self.xShopStart, self.yShopStart,
         z) = player.GetMainCharacterPosition()
        if app.WJ_ENABLE_TRADABLE_ICON:
            if not isPrivateShop:
                self.interface.SetOnTopWindow(player.ON_TOP_WND_SHOP)
                self.interface.RefreshMarkInventoryBag()