コード例 #1
0
    def Upgrade(self):
        ItemIndex = self.ListBoxItems.GetSelectedItem()
        if ItemIndex:
            pass
        else:
            chat.AppendChat(7, "[Inv-Manager] No Item selected!")
            return
        try:
            SearchedName = ItemIndex.GetText().split("    ")[2].split("+")[0]
        except:
            SearchedName = ItemIndex.GetText().split("    ")[2]

        SelectedItem = ItemIndex.GetText().split("    ")
        count = int(self.UpgradeEditline.GetText())

        if self.ModeCombo.GetCurrentText() == 'Normal':
            self.UpgradeItem(1, int(SelectedItem[0]), int(count))
        elif self.ModeCombo.GetCurrentText() == 'DT':
            self.UpgradeItem(2, int(SelectedItem[0]), int(count))
        elif self.ModeCombo.GetCurrentText() == 'Guild':
            self.UpgradeItem(3, int(SelectedItem[0]), int(count))
        elif self.ModeCombo.GetCurrentText() == 'Bless':
            self.UpgradeItem(4, int(SelectedItem[0]), int(count))
        elif self.ModeCombo.GetCurrentText() == 'Normal - All':
            for j in xrange(0, 90):
                ItemValue = player.GetItemIndex(j)
                try:
                    ItemName = item.GetItemName(
                        item.SelectItem(ItemValue)).split("+")[0]
                except:
                    ItemName = item.GetItemName(item.SelectItem(ItemValue))
                if ItemName == SearchedName:
                    self.UpgradeItem(1, j, int(count))
        elif self.ModeCombo.GetCurrentText() == 'Metal':
            self.UpgradeItem(5, int(SelectedItem[0]), int(count))
コード例 #2
0
ファイル: uiinventory.py プロジェクト: Reizonr1/metin2-adv
    def __SellItem(self, itemSlotPos):
        if not player.IsEquipmentSlot(itemSlotPos):
            self.sellingSlotNumber = itemSlotPos
            itemIndex = player.GetItemIndex(itemSlotPos)
            itemCount = player.GetItemCount(itemSlotPos)

            self.sellingSlotitemIndex = itemIndex
            self.sellingSlotitemCount = itemCount

            item.SelectItem(itemIndex)
            ## 안티 플레그 검사 빠져서 추가
            ## 20140220
            if item.IsAntiFlag(item.ANTIFLAG_SELL):
                popup = uiCommon.PopupDialog()
                popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
                popup.SetAcceptEvent(self.__OnClosePopupDialog)
                popup.Open()
                self.popup = popup
                return

            itemPrice = player.GetISellItemPrice(itemSlotPos)

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

            self.questionDialog = uiCommon.QuestionDialog()
            self.questionDialog.SetText(
                localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
            self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
            self.questionDialog.SetCancelEvent(
                ui.__mem_func__(self.OnCloseQuestionDialog))
            self.questionDialog.Open()
            self.questionDialog.count = itemCount

            constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
コード例 #3
0
ファイル: uicube.py プロジェクト: Kunstnebel/famousmt2
    def __OverInMaterialSlot(self, trash, resultIndex, col):
        self.tooltipItem.ClearToolTip()
        self.tooltipItem.SetCannotUseItemForceSetDisableColor(FALSE)

        resultIndex = resultIndex + self.firstSlotIndex

        if resultIndex not in self.cubeMaterialInfos:
            return

        i = 0
        materialInfo = self.cubeMaterialInfos[resultIndex]
        materialCount = len(materialInfo[col])

        for itemVnum, count in materialInfo[col]:
            item.SelectItem(itemVnum)
            if player.GetItemCountByVnum(itemVnum) >= count:
                self.tooltipItem.AppendTextLine(
                    "%s" % (item.GetItemName()),
                    grp.GenerateColor(0.5411, 0.7254, 0.5568,
                                      1.0)).SetFeather()
            else:
                self.tooltipItem.AppendTextLine(
                    "%s" % (item.GetItemName()),
                    grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)).SetFeather()

            if i < materialCount - 1:
                self.tooltipItem.AppendTextLine(
                    uiScriptLocale.CUBE_REQUIRE_MATERIAL_OR)

            i = i + 1

        self.tooltipItem.Show()
コード例 #4
0
    def __SellItem(self, itemSlotPos):
        if not player.IsEquipmentSlot(itemSlotPos):
            self.sellingSlotNumber = itemSlotPos
            itemIndex = player.GetItemIndex(itemSlotPos)
            itemCount = player.GetItemCount(itemSlotPos)

            item.SelectItem(itemIndex)
            itemPrice = item.GetISellItemPrice()

            if item.Is1GoldItem():
                itemPrice = itemCount / itemPrice / 5
            else:
                itemPrice = itemPrice * itemCount / 5

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

            self.questionDialog = uiCommon.QuestionDialog()
            self.questionDialog.SetText(
                locale.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
            self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
            self.questionDialog.SetCancelEvent(
                ui.__mem_func__(self.OnCloseQuestionDialog))
            self.questionDialog.Open()
            self.questionDialog.count = itemCount
コード例 #5
0
 def UpdateFileList(self, mode):
     SearchName = str(self.PickSearchItemEditLine.GetText())
     SelectedIndex = self.PickfileListBox.GetSelectedItem()
     self.__RefreshFileList()
     try:
         lines = open(app.GetLocalePath() + "/item_list.txt",
                      "r").readlines()
     except IOError:
         OpenLog.DebugPrint(
             "Load Itemlist Error, you have so set the IDs manually")
         self.Close()
     for line in lines:
         tokens = str(line).split("\t")
         Index = str(tokens[0])
         try:
             Itemname = item.GetItemName(item.SelectItem(int(Index)))
         except Exception:
             continue
         if mode == 1:
             if Index and str(Itemname) != "":
                 self.PickfileListBox.AppendItem(
                     OpenLib.Item(Index + "  " + Itemname))
         elif mode == 2:
             if str(Itemname).find(str(SearchName)) != -1:
                 self.PickfileListBox.AppendItem(
                     OpenLib.Item(Index + "  " + Itemname))
         elif mode == 3:
             if str(Itemname) == str(
                     SelectedIndex.GetText().split("  ")[1]):
                 ItemValue = Index.split("  ")[0]
                 self.CreateItemDialog.UpdateItem(int(ItemValue))
                 self.Close()
                 break
コード例 #6
0
	def SelectEmptySlot(self, slotIndex):
		try:
			if (constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1):
				return
				
			if (mouseModule.mouseController.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)
				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.OFFLINE_SHOP_CANNOT_SELL_ITEM)
					return
					
				priceInputBoard = uiCommon.MoneyInputDialog()
				priceInputBoard.SetTitle(item.GetItemName() + "'s price")
				priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
				priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
				priceInputBoard.Open()
				
				self.priceInputBoard = priceInputBoard
				self.priceInputBoard.bDisplayPos = slotIndex
				self.priceInputBoard.bPos = attachedSlotPos
		except Exception, e:
			import dbg
			dbg.TraceError("Exception : SelectEmptySlot, %s" %(e))
コード例 #7
0
	def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
		metinIndex = player.GetItemIndex(metinSlotPos)
		targetIndex = player.GetItemIndex(targetSlotPos)

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

		result = player.CanAttachMetin(metinIndex, targetSlotPos)

		if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))

		if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NO_SOCKET(itemName))

		elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))

		elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
			chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_EQUIP_ITEM)

		if player.ATTACH_METIN_OK != result:
			return

		self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
コード例 #8
0
	def LoadInfoPage(self):
		data = craftingproto.GetCraftingProto(self.crafting_proto_name)
		if data == False:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "<Crafting> No Proto named " + self.crafting_proto_name)
			return
			
		data = data["CONTENT"][self.selected_recipe]
		item.SelectItem(data["itemVnum"])
		self.itemSlot.SetItemSlot(0,data["itemVnum"],0)
		
		self.itemNameTextLine.SetText(localeInfo.CRAFTING_WINDOW_NAME + item.GetItemName())
		self.itemCountTextLine.SetText(localeInfo.CRAFTING_WINDOW_COUNT + str(data["itemCount"]))
		self.itemChanceTextLine.SetText(localeInfo.CRAFTING_WINDOW_CHANCE + str(data["baseChance"]) + "%")		
		
		materialList = data["materialList"]
		for i in xrange(10):
			try:
				self.materialItemSlots[i].ClearItemData()
				self.materialItemSlots[i].SetItemData(materialList[i]["item"])
				self.materialItemSlots[i].SetItemCount(materialList[i]["itemCount"])

			except:
				self.materialItemSlots[i].ClearItemData()



		self.money.SetText(constInfo.NumberToPointString(data["gold"]) + localeInfo.CRAFTING_WINDOW_GOLD)
		
		self.noItemPage.Hide()	
コード例 #9
0
    def AppendMaterial(self, vnum, count):
        slot = self.__MakeSlot()
        slot.SetParent(self)
        slot.SetPosition(15, self.dialogHeight)

        itemImage = self.__MakeItemImage()
        itemImage.SetParent(slot)
        item.SelectItem(vnum)
        itemImage.LoadImage(item.GetIconImageFileName())

        thinBoard = self.__MakeThinBoard()
        thinBoard.SetPosition(50, self.dialogHeight)
        thinBoard.SetSize(191, 20)

        textLine = ui.TextLine()
        textLine.SetParent(thinBoard)
        textLine.SetFontName(localeInfo.UI_DEF_FONT)
        textLine.SetPackedFontColor(0xffdddddd)
        textLine.SetText("%s x %02d" % (item.GetItemName(), count))
        textLine.SetOutline()
        textLine.SetFeather(False)
        textLine.SetWindowVerticalAlignCenter()
        textLine.SetVerticalAlignCenter()

        if localeInfo.IsARABIC():
            (x, y) = textLine.GetTextSize()
            textLine.SetPosition(x, 0)
        else:
            textLine.SetPosition(15, 0)

        textLine.Show()
        self.children.append(textLine)

        self.dialogHeight += 34
        self.UpdateDialog()
コード例 #10
0
	def __OnSelectEmptySlot(self, selectedSlotPos):
		self.index,self.pos=None,None
		self.__OnLimpiar()
		isAttached = mouseModule.mouseController.isAttached()
		if isAttached:
			attachedSlotType = mouseModule.mouseController.GetAttachedType()
			attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()

			mouseModule.mouseController.DeattachObject()
			if player.SLOT_TYPE_INVENTORY != attachedSlotType:
				return

			attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
			count = player.GetItemCount(attachedInvenType, attachedSlotPos)
				
			itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
			item.SelectItem(itemVNum)

		self.slot.ClearSlot(selectedSlotPos)
		self.slot.SetItemSlot(selectedSlotPos, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
		self.index = player.GetItemIndex(attachedSlotPos)
		self.pos = attachedSlotPos
		self.slotpos=selectedSlotPos
		self.vnum = player.GetItemIndex(attachedSlotPos)
		self.item_name.SetText(item.GetItemName())
コード例 #11
0
    def SetItem(self, vnum, angebot, price, suffix, rabatt, shop):
        item.SelectItem(vnum)
        itemIcon = item.GetIconImageFileName()
        itemName = item.GetItemName()

        if (angebot >= 0 and rabatt > 0):
            price -= int((price * (float(rabatt) / 100.0)) // 1)
            if angebot == 0:
                angebot = 'Permanent'
            else:
                angebot = self.__EasyBuild.toTimeString(angebot)
            self.SetAngebot(angebot + (" - %d%%" % rabatt))
        else:
            self.UnsetAngebot()

        self.itemIcon.LoadImage(itemIcon)
        self.itemIcon.SetScale(1,
                               float(32.0 / float(self.itemIcon.GetHeight())))
        self.itemPrice.SetText("%d %s" % (price, suffix))
        self.itemName.SetText(itemName)

        self.itemVnum = vnum
        self.price = price
        self.suffix = suffix
        self.ShopId = shop
        self.Show()
コード例 #12
0
	def OnInsertItemIcon(self, type, idx, title, desc, index=0, total=1):
		if "item" != type:
			return

		import item
		item.SelectItem(idx)
		filename = item.GetIconImageFileName()

		underTitle = title

		if not title and not desc:
			title = item.GetItemName()
			desc = item.GetItemDescription()

			tempDesc = desc
			desc = ""

			import grpText
			lineCount = grpText.GetSplitingTextLineCount(tempDesc, 25)
			for i in xrange(lineCount):
				desc += grpText.GetSplitingTextLine(tempDesc, 25, i) + "/"

			desc = desc[:-1]

		self.OnInsertImage(filename, underTitle, title, desc, index, total)
コード例 #13
0
	def LoadNavigation(self,data):
		# data = craftingproto.CRAFTING_PROTO[self.crafting_proto_name][0]["category_data"]
		self.navigation.ClearAll()
		
		data = data["CONTENT"]
		for i in xrange(len(data)):
			# chat.AppendChat(chat.CHAT_TYPE_INFO, "i: " + str(i))
			if data[i]["type"] == "title":
				self.navigation.AppendTitleItem(data[i]["text"])
			
			# elif data[i]["type"] == "nav_item":
				# self.navigation.AppendNavItem(data[i]["category_name"],0,i,False)

			elif data[i]["type"] == "item":
				item.SelectItem(data[i]["itemVnum"])
				self.navigation.AppendNavItem(item.GetItemName(),data[i]["itemVnum"],i,True)
			
			elif data[i]["type"] == "empty":
				self.navigation.AppendEmptyItem()
				
			# elif data[i]["type"] == "back_item":
				# self.navigation.AppendBackItem()
			else:
				chat.AppendChat(chat.CHAT_TYPE_INFO,"Unknown category_type: " + str(data[i]["type"]))

		self.navigation.Build()			
コード例 #14
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)
コード例 #15
0
	def Get(self,slot):
		if int(slot) in constInfo.gift_items.keys():
			it=constInfo.gift_items[int(slot)]
			item.SelectItem(int(it["vnum"]))
			self.pop = uiCommon.QuestionDialog()
			self.pop.SetText(uiScriptLocale.GIFT_GET_QUEST%(item.GetItemName()))
			self.pop.SetAcceptEvent(lambda arg1=str(it["id"]): self.OnGet(arg1))
			self.pop.SetCancelEvent(ui.__mem_func__(self.__OnClosePopupDialog))
			self.pop.Open()
コード例 #16
0
 def UpdatePickFilterList(self):
     searchValue = self.PickSearchItemEditLine.GetText()
     self.PickfileListBox.RemoveAllItems()
     for filterItem in sorted(self.pickFilter):
         item.SelectItem(filterItem)
         name = item.GetItemName()
         if searchValue in name:
             self.PickfileListBox.AppendItem(
                 OpenLib.Item(str(filterItem) + " " + name))
コード例 #17
0
	def SetContent(self, vnum, count, index):
		item.SelectItem(vnum)
		self.icon_items[index].LoadImage(item.GetIconImageFileName())
		self.list_items.append(vnum)
		self.bg_items[index].Show()

		if vnum == 1:
			self.name_items[index].SetText(item.GetItemName()+": "+str(count))
			self.count_items[index].SetText("1")
			return

		if vnum == 2:
			self.name_items[index].SetText("Exp: "+str(count))
			self.count_items[index].SetText("1")
			return
		
		self.name_items[index].SetText(item.GetItemName())
		self.count_items[index].SetText(str(count))
コード例 #18
0
	def OnUpdateKeyVnum(self):
		ui.EditLine.OnIMEUpdate(self.main["elements"]["slot_vnum"])

		def GetText():
			return str(self.main["elements"]["slot_vnum"].GetText())

		def GetTextSize():
			return len(GetText())

		def SetKey(key):
			if key in [oxevent.CLEAR_DATA, oxevent.REFRESH_DATA]:
				self.vnumIndex = []
				self.listKeys = []
				self.row = 0
				
			if key != oxevent.REFRESH_DATA:
				self.SetStatusListBox(0)

			self.main["elements"]["listbox"].ClearItem()

		def GetItemCountListBox():
			return self.main["elements"]["listbox"].GetItemCount()

		def SetSizeListBox():
			for it in [self.main["elements"]["listbox"], self.main["elements"]["listbox_bar"]]:
				it.SetSize(200, 17.5 * GetItemCountListBox())
		
		if GetTextSize() <= oxevent.NEED_SIZE:
			SetKey(oxevent.CLEAR_DATA)
			return

		SetKey(oxevent.REFRESH_DATA)
		c_szText = GetText()

		for key in item_proto_list.DICT:
			c_szItem, c_szName = key["vnum"], key["name"]

			if len(c_szName) >= len(c_szText) and c_szName[:len(c_szText)].lower() == c_szText.lower():
				self.listKeys.append(c_szItem)

		for key in xrange(len(self.listKeys)):
			if self.row >= oxevent.MAX_ROWS:
				break

			item.SelectItem(self.listKeys[key])
			c_szName = item.GetItemName()

			self.main["elements"]["listbox"].InsertItem(key, c_szName)
			self.vnumIndex.append(self.listKeys[key])
			self.row += 1

		self.SetStatusListBox(1)
		SetSizeListBox()

		if len(self.vnumIndex) == (oxevent.NEED_SIZE - 1):
			SetKey(oxevent.CLEAR_DATA)
			return
コード例 #19
0
 def GetCurrencyName(self, type, vnum):
     if type == self.CURRENCY_TYPE_ITEM:
         item.SelectItem(vnum)
         return item.GetItemName()
     else:
         try:
             return self.CURRENCY_NAME_DICT[type]
         except:
             return "NO_CURRENCY_NAME_FOUND"
コード例 #20
0
 def UpdateFileList(self):
     self.ListBoxItems.RemoveAllItems()
     for i in xrange(100):
         ItemIndex = player.GetItemIndex(i)
         if ItemIndex != 0:
             ItemName = item.GetItemName(item.SelectItem(int(ItemIndex)))
             self.ListBoxItems.AppendItem(
                 OpenLib.Item(
                     str(i) + '    ' + str(player.GetItemIndex(i)) +
                     '    ' + ItemName))
コード例 #21
0
    def BuyItem(self, slot):
        chat.AppendChat(chat.CHAT_TYPE_DEBUG, "CLICK ITEM! slot: " + str(slot))

        index = self.slotLink[slot]
        itemInfo = self.shopContent[self.category]["category_content"][index]
        item.SelectItem(itemInfo["item_vnum"])
        if app.IsPressed(app.DIK_LSHIFT):
            chat.AppendChat(chat.CHAT_TYPE_DEBUG, "SHIFT PRESSED! BUY MORE!")

            self.buyItemDialog = BuyMultipleItemDialog()
            self.buyItemDialog.SetAcceptEvent(
                lambda arg=True: self.RequestBuyItem(arg))
            self.buyItemDialog.SetCancelEvent(
                lambda arg=False: self.RequestBuyItem(arg))
            self.buyItemDialog.slot = slot
            self.buyItemDialog.count = 1
            self.buyItemDialog.price = itemInfo["currency_count"]
            self.buyItemDialog.SetInfo(
                item.GetItemName(),
                self.GetCurrencyName(itemInfo["currency_type"],
                                     itemInfo["currency_vnum"]),
                itemInfo["currency_count"])
            self.buyItemDialog.itemShopIndex = itemInfo["item_shop_index"]
            self.buyItemDialog.Open()

        else:
            chat.AppendChat(chat.CHAT_TYPE_DEBUG,
                            "SHIFT NOT PRESSED! BUY ONE!")
            self.buyItemDialog = BuySingleItemDialog()
            self.buyItemDialog.SetAcceptEvent(
                lambda arg=True: self.RequestBuyItem(arg))
            self.buyItemDialog.SetCancelEvent(
                lambda arg=False: self.RequestBuyItem(arg))
            self.buyItemDialog.slot = slot
            self.buyItemDialog.count = 1
            self.buyItemDialog.SetInfo(
                item.GetItemName(),
                self.GetCurrencyName(itemInfo["currency_type"],
                                     itemInfo["currency_vnum"]),
                itemInfo["currency_count"])
            self.buyItemDialog.itemShopIndex = itemInfo["item_shop_index"]
            self.buyItemDialog.Open()
コード例 #22
0
    def retrieveItems(self):
        OpenLog.DebugPrint("========= Retrieving item list ==========")

        for slot in range(SLOTS):
            item_id = player.GetItemIndex(slot)
            if item_id != 0:
                item.SelectItem(item_id)
                self.list.append(
                    Item(item_id, slot, int(item.GetItemSize()[1]),
                         item.GetItemName()))

        OpenLog.DebugPrint("========= Retrieving successful ==========")
コード例 #23
0
    def SellAttachedItem(self):

        if shop.IsPrivateShop():
            mouseModule.mouseController.DeattachObject()
            return

        attachedSlotType = mouseModule.mouseController.GetAttachedType()
        attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
        attachedCount = mouseModule.mouseController.GetAttachedItemCount()

        if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:

            item.SelectItem(attachedItemIndex)

            if item.IsAntiFlag(item.ANTIFLAG_SELL):
                popup = uiCommon.PopupDialog()
                popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
                popup.SetAcceptEvent(self.__OnClosePopupDialog)
                popup.Open()
                self.popup = popup
                return

            itemtype = player.INVENTORY

            if player.IsValuableItem(itemtype, attachedSlotPos):

                itemPrice = player.GetISellItemPrice(attachedSlotPos)

                itemName = item.GetItemName()

                questionDialog = uiCommon.QuestionDialog()
                questionDialog.SetText(
                    localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount,
                                                itemPrice))

                questionDialog.SetAcceptEvent(
                    lambda arg1=attachedSlotPos, arg2=attachedCount, arg3=
                    itemtype: self.OnSellItem(arg1, arg2, arg3))
                questionDialog.SetCancelEvent(
                    ui.__mem_func__(self.OnCloseQuestionDialog))
                questionDialog.Open()
                self.questionDialog = questionDialog

                constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)

            else:
                self.OnSellItem(attachedSlotPos, attachedCount, itemtype)

        else:
            snd.PlaySound("sound/ui/loginfail.wav")

        mouseModule.mouseController.DeattachObject()
コード例 #24
0
    def SellAttachedItem(self):

        if shop.IsPrivateShop():
            mouseModule.mouseController.DeattachObject()
            return

        attachedSlotType = mouseModule.mouseController.GetAttachedType()
        attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
        attachedCount = mouseModule.mouseController.GetAttachedItemCount()
        if player.SLOT_TYPE_INVENTORY == attachedSlotType:

            itemIndex = player.GetItemIndex(attachedSlotPos)
            item.SelectItem(itemIndex)

            if item.IsAntiFlag(item.ANTIFLAG_SELL):
                popup = uiCommon.PopupDialog()
                popup.SetText(locale.SHOP_CANNOT_SELL_ITEM)
                popup.SetAcceptEvent(self.__OnClosePopupDialog)
                popup.Open()
                self.popup = popup

            elif player.IsValuableItem(attachedSlotPos):

                itemPrice = item.GetISellItemPrice()

                if item.Is1GoldItem():
                    itemPrice = attachedCount / itemPrice / 5
                else:
                    itemPrice = itemPrice * max(1, attachedCount) / 5

                itemName = item.GetItemName()

                questionDialog = uiCommon.QuestionDialog()
                questionDialog.SetText(
                    locale.DO_YOU_SELL_ITEM(itemName, attachedCount,
                                            itemPrice))

                questionDialog.SetAcceptEvent(
                    lambda arg1=attachedSlotPos, arg2=attachedCount: self.
                    OnSellItem(arg1, arg2))
                questionDialog.SetCancelEvent(
                    ui.__mem_func__(self.OnCloseQuestionDialog))
                questionDialog.Open()
                self.questionDialog = questionDialog

            else:
                self.OnSellItem(attachedSlotPos, attachedCount)

        else:
            snd.PlaySound("sound/ui/loginfail.wav")

        mouseModule.mouseController.DeattachObject()
コード例 #25
0
	def AppendMaterial(self, vnum, count):
		slot = self.__MakeSlot()
		slot.SetParent(self)
		slot.SetPosition(22, self.dialogHeight+20)

		itemImage = self.__MakeItemImage()
		itemImage.SetParent(slot)
		item.SelectItem(vnum)
		itemImage.LoadImage(item.GetIconImageFileName())

		thinBoard = self.__MakeThinBoard()
		thinBoard.SetPosition(58, self.dialogHeight+20)
		thinBoard.SetSize(191, 20)

		textLine = ui.TextLine()
		textLine.SetParent(thinBoard)
		textLine.SetFontName(localeInfo.UI_DEF_FONT)
		
		itemMaterialCount = fgGHGjjFHJghjfFG1545gGG.GetItemCountByVnum(vnum)
		if itemMaterialCount < count:
			if settinginfo.GetUppItemCountByItemVnum_NEW(vnum) < count:
				textLine.SetPackedFontColor(0xffFF0033)
				
				if itemMaterialCount == 0:
					itemMaterialCount = settinginfo.GetUppItemCountByItemVnum_NEW(vnum)
				
			else:
				itemMaterialCount = settinginfo.GetUppItemCountByItemVnum_NEW(vnum)
				textLine.SetPackedFontColor(0xff40EF37)
		else:
			itemMaterialCount = fgGHGjjFHJghjfFG1545gGG.GetItemCountByVnum(vnum)
			textLine.SetPackedFontColor(0xff40EF37)
			
			
		textLine.SetText("%s x%d|h|r (%d)" % (item.GetItemName(), count, itemMaterialCount))
		textLine.SetOutline()
		textLine.SetFeather(False)
		textLine.SetWindowVerticalAlignCenter()
		textLine.SetVerticalAlignCenter()

		if localeInfo.IsARABIC():
			(x,y) = textLine.GetTextSize()
			textLine.SetPosition(x, 0)
		else:
			textLine.SetPosition(15, 0)

		textLine.Show()
		self.children.append(textLine)

		self.dialogHeight += 34
		self.UpdateDialog()
コード例 #26
0
    def OpenRewardDialog(self, itemVnum, itemCount):
        item.SelectItem(itemVnum)
        itemName = item.GetItemName()

        get_text_pos = (item.GetItemSize()[1] * 20) + self.GET_TEXT_BASE_HEIGHT

        self.rewardDialogItemName.SetText(
            str(itemCount) + "x " + str(itemName))
        self.rewardDialogItemName.SetPosition(337, get_text_pos)
        self.rewardDialogInfo.SetPosition(337, get_text_pos + 20)
        self.rewardDialogCloseButton.SetPosition(679 / 2 - 48,
                                                 get_text_pos + 20 + 30)
        self.rewardDialogItemImage.LoadImage(item.GetIconImageFileName())
        self.rewardDialog.Show()
コード例 #27
0
ファイル: uiofflineshop.py プロジェクト: Reizonr1/metin2-adv
    def UnselectItemSlot(self, selectedSlotPos):
        if (constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1):
            return

        itemIndex = shop.GetOfflineShopItemID(selectedSlotPos)
        item.SelectItem(itemIndex)
        itemName = item.GetItemName()

        priceInputBoard = uiCommon.MoneyInputDialog()
        priceInputBoard.SetTitle(itemName + "Yeni fiyat")
        priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
        priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
        priceInputBoard.Open()
        self.priceInputBoard = priceInputBoard
        self.priceInputBoard.pos = selectedSlotPos
コード例 #28
0
	def UseItemSlot(self, slotIndex):
		ADD_ITEM_NEED_COUNT = [0, 0, 0, 1, 2, 4, 8, 8, 8]

		if player.GetGemShopItemStatus(slotIndex) == 1:
			haveCount = constInfo.COUNT_SPECIFY_ITEM(self.GEM_SHOP_ADD_ITEM_VNUM)
			needCount = ADD_ITEM_NEED_COUNT[slotIndex]
			item.SelectItem(self.GEM_SHOP_ADD_ITEM_VNUM)
			if haveCount < needCount:
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GEM_SYSTEM_NOT_ENOUGHT_ADDITEM % (str(item.GetItemName()), int(needCount - haveCount)))
			else:
				self.SlotAddQuestion(slotIndex, needCount, item.GetItemName())
		else:
			if player.GetGem() < player.GetGemShopItemPrice(slotIndex):
				chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.GEM_SYSTEM_NOT_ENOUGH_HP_GEM)
			else:
				self.GemShopSlotBuy(slotIndex)
コード例 #29
0
			def OnUpdate(self):
				if self.stoneImg != None and self.stoneVnum != None and app.GetTime() >= self.nextStoneIconChange:
					nextImg = self.lastStoneVnum + 1
					if nextImg % 100 > self.STONE_LAST_VNUM % 100:
						nextImg -= (self.STONE_LAST_VNUM - self.STONE_START_VNUM) + 1
					self.lastStoneVnum = nextImg
					self.nextStoneIconChange = app.GetTime() + 2.5

					item.SelectItem(nextImg)
					itemName = item.GetItemName()
					realName = itemName[:itemName.find("+")]
					realName = realName + "+0 - +4"
					self.stoneImg.LoadImage(item.GetIconImageFileName(), realName)

					if self.itemTooltip.IsShow() and self.itemTooltip.isStone:
						self.itemTooltip.SetItemToolTip(nextImg)
コード例 #30
0
	def UnselectItemSlot(self, selectedSlotPos):
		if (constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1):
			return
			
		itemIndex = shop.GetOfflineShopItemID(selectedSlotPos)
		item.SelectItem(itemIndex)
		itemName = item.GetItemName()
		
		questionDialog = uiCommon.QuestionDialog()
		questionDialog.SetText(localeInfo.DO_YOU_WANT_TO_REMOVE_ITEM % (itemName))
		questionDialog.SetAcceptEvent(lambda arg = True : self.AnswerRemoveItem(arg))
		questionDialog.SetCancelEvent(lambda arg = False : self.AnswerRemoveItem(arg))
		questionDialog.Open()
		questionDialog.pos = selectedSlotPos
		self.questionDialog = questionDialog
		
		constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)