Example #1
0
        def RegisterShopSold(self, pos):
            if pos < 0 or not shop.GetItemID(pos):
                return
            item.SelectItem(int(shop.GetItemID(pos)))
            (itemWidth, itemHeight) = item.GetItemSize()

            targetSlot = self.itemSlotList["ItemSlot_%d" % self.GridSize]
            imageName = "d:/ymir work/slot_disabled_%d.tga" % itemHeight

            targetSlot.SetCoverButton(
                pos, imageName, imageName, imageName,
                "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False,
                False)
            targetSlot.EnableSlot(pos)
            wndMgr.RefreshSlot(targetSlot.GetWindowHandle())
    def SelectItemSlot(self, selectedSlotPos):
        if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
            return

        isAttached = mouseModule.mouseController.isAttached()
        selectedSlotPos = self.__GetRealIndex(selectedSlotPos)
        if isAttached:
            self.SellAttachedItem()

        else:

            if True == shop.IsMainPlayerPrivateShop():
                return

            curCursorNum = app.GetCursor()
            if app.BUY == curCursorNum:
                self.AskBuyItem(selectedSlotPos)

            elif app.SELL == curCursorNum:
                chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_SELL_INFO)

            else:
                selectedItemID = shop.GetItemID(selectedSlotPos)
                itemCount = shop.GetItemCount(selectedSlotPos)

                type = player.SLOT_TYPE_SHOP
                if shop.IsPrivateShop():
                    type = player.SLOT_TYPE_PRIVATE_SHOP

                mouseModule.mouseController.AttachObject(
                    self, type, selectedSlotPos, selectedItemID, itemCount)
                mouseModule.mouseController.SetCallBack(
                    "INVENTORY", ui.__mem_func__(self.DropToInventory))
                snd.PlaySound("sound/ui/pick.wav")
Example #3
0
    def AskBuyItem(self, slotPos):
        if not app.ENABLE_OFFLINE_SHOP:
            slotPos = self.__GetRealIndex(slotPos)

        itemIndex = shop.GetItemID(slotPos)
        itemPrice = shop.GetItemPrice(slotPos)
        if app.ENABLE_OFFLINE_SHOP:
            itemPriceTwo = shop.GetItemPrice2(slotPos)
            itemPriceThree = shop.GetItemPrice3(slotPos)
            itemPriceFour = shop.GetItemPrice4(slotPos)
        itemCount = shop.GetItemCount(slotPos)

        item.SelectItem(itemIndex)
        itemName = item.GetItemName()

        if app.ENABLE_OFFLINE_SHOP:
            if not itemPriceTwo and not itemPriceThree and not itemPriceFour:
                itemBuyQuestionDialog = uiCommon.QuestionDialog()
                itemBuyQuestionDialog.SetText(
                    localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, itemPrice))
            else:
                itemBuyQuestionDialog = uiCommon.QuestionDialog2()
                itemBuyQuestionDialog.SetText1(
                    localeInfo.DO_YOU_BUY_ITEM_NEW(
                        itemName, itemCount,
                        localeInfo.NumberToMoneyString(itemPrice),
                        localeInfo.NumberToPriceString(itemPriceTwo, "Coin"),
                        localeInfo.NumberToPriceString(itemPriceThree,
                                                       "Goldbar"),
                        localeInfo.NumberToPriceString(itemPriceFour,
                                                       "Won"))[0])
                itemBuyQuestionDialog.SetText2(
                    localeInfo.DO_YOU_BUY_ITEM_NEW(
                        itemName, itemCount,
                        localeInfo.NumberToMoneyString(itemPrice),
                        localeInfo.NumberToPriceString(itemPriceTwo, "Coin"),
                        localeInfo.NumberToPriceString(itemPriceThree,
                                                       "Goldbar"),
                        localeInfo.NumberToPriceString(itemPriceFour,
                                                       "Won"))[1])
        else:
            itemBuyQuestionDialog = uiCommon.QuestionDialog()
            itemBuyQuestionDialog.SetText(
                localeInfo.DO_YOU_BUY_ITEM(
                    itemName, itemCount,
                    localeInfo.NumberToMoneyString(itemPrice)))

        itemBuyQuestionDialog.SetAcceptEvent(
            lambda arg=True: self.AnswerBuyItem(arg))
        itemBuyQuestionDialog.SetCancelEvent(
            lambda arg=False: self.AnswerBuyItem(arg))
        if app.ENABLE_OFFLINE_SHOP:
            if itemPriceTwo or itemPriceThree or itemPriceFour:
                itemBuyQuestionDialog.SetWidth(550)
        itemBuyQuestionDialog.Open()
        itemBuyQuestionDialog.pos = slotPos
        self.itemBuyQuestionDialog = itemBuyQuestionDialog

        constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
Example #4
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()
Example #5
0
    def AskBuyItem(self, slotPos):
        slotPos = self.__GetRealIndex(slotPos)

        itemIndex = shop.GetItemID(slotPos)
        itemPrice = shop.GetItemPrice(slotPos)
        itemCount = shop.GetItemCount(slotPos)

        item.SelectItem(itemIndex)
        itemName = item.GetItemName()

        itemBuyQuestionDialog = uiCommon.QuestionDialog()
        itemBuyQuestionDialog.SetText(
            locale.DO_YOU_BUY_ITEM(itemName, itemCount,
                                   locale.NumberToMoneyString(itemPrice)))
        itemBuyQuestionDialog.SetAcceptEvent(
            lambda arg=TRUE: self.AnswerBuyItem(arg))
        itemBuyQuestionDialog.SetCancelEvent(
            lambda arg=FALSE: self.AnswerBuyItem(arg))
        itemBuyQuestionDialog.Open()
        itemBuyQuestionDialog.pos = slotPos
        self.itemBuyQuestionDialog = itemBuyQuestionDialog
    def AskBuyItem(self, slotPos):
        slotPos = self.__GetRealIndex(slotPos)

        itemIndex = shop.GetItemID(slotPos)
        itemPrice = shop.GetItemPrice(slotPos)
        itemCount = shop.GetItemCount(slotPos)

        item.SelectItem(itemIndex)
        itemName = item.GetItemName()

        itemBuyQuestionDialog = uiCommon.QuestionDialog()
        itemBuyQuestionDialog.SetText(
            localeInfo.DO_YOU_BUY_ITEM(
                itemName, itemCount,
                localeInfo.NumberToMoneyString(itemPrice)))
        itemBuyQuestionDialog.SetAcceptEvent(
            lambda arg=True: self.AnswerBuyItem(arg))
        itemBuyQuestionDialog.SetCancelEvent(
            lambda arg=False: self.AnswerBuyItem(arg))
        itemBuyQuestionDialog.Open()
        itemBuyQuestionDialog.pos = slotPos
        self.itemBuyQuestionDialog = itemBuyQuestionDialog

        constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)