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)
def GemShopSlotBuy(self, slotIndex): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.GEM_SYSTEM_BUY_ITEM) questionDialog.SetAcceptEvent(lambda arg = int(slotIndex): ui.__mem_func__(self.SendBuyAccept)(arg)) questionDialog.SetCancelEvent(ui.__mem_func__(self.SlotAddQuestionCancel)) questionDialog.Open() self.questionDialog = questionDialog
def CloseShop(self, shop): self.pop = uiCommon.QuestionDialog() self.pop.SetText(uiScriptLocale.SHOP_CLOSE_QUEST % (shop["name"])) self.pop.SetAcceptEvent( lambda arg1=str(shop["id"]): self.OnCloseShop(arg1)) self.pop.SetCancelEvent(ui.__mem_func__(self.__OnClosePopupDialog)) self.pop.Open()
def __LoadWindow(self): try: PythonScriptLoader = ui.PythonScriptLoader() PythonScriptLoader.LoadScriptFile( self, "UIScript/AchievementShop_ItemBox.py") except: import exception exception.Abort("AchievementShop_ItemBox.LoadDialog.BindObject") self.itemName = self.GetChild("ItemName") self.itemIcon = self.GetChild("ItemIcon") self.itemPrice = self.GetChild("ItemPrice") self.itemAmount = self.GetChild("ItemAmount") self.buyButton = self.GetChild("BuyButton") self.toolTip = uiToolTip.ItemToolTip() self.toolTip.HideToolTip() self.itemIcon.SAFE_SetStringEvent("MOUSE_OVER_IN", self.toolTip.ShowToolTip) self.itemIcon.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.toolTip.HideToolTip) self.BuyQuestion = uiCommon.QuestionDialog() self.BuyQuestion.SetAcceptEvent( lambda arg=TRUE: self.AnswerBuyItem(arg)) self.BuyQuestion.SetCancelEvent( lambda arg=FALSE: self.AnswerBuyItem(arg)) self.buyButton.SetEvent(ui.__mem_func__(self.__OnClickBuyButton)) self.isLoaded = True
def CloseRequest(self): self.QuestionDialog = uiCommon.QuestionDialog() self.QuestionDialog.SetText("Do You want to quit Metin2 immediately?") self.QuestionDialog.SetAcceptEvent(ui.__mem_func__(self.Close)) self.QuestionDialog.SetCancelEvent( ui.__mem_func__(self.CancelQuestionDialog)) self.QuestionDialog.Open()
def AskQuestion(self): self.wndQuestionDialog = uiCommon.QuestionDialog() self.wndQuestionDialog.SetText(localeInfo.ANNOUNCEMENT_MANAGER_QUESTION_SEND) self.wndQuestionDialog.SetWidth(300) self.wndQuestionDialog.SetAcceptEvent(lambda arg = TRUE: self.AnswerOnQuestion(arg)) self.wndQuestionDialog.SetCancelEvent(lambda arg = FALSE: self.AnswerOnQuestion(arg)) self.wndQuestionDialog.Open()
def CreateQuestionDialog(self, text, yes_func, no_func): wndQuestionDialog = uiCommon.QuestionDialog() wndQuestionDialog.SetText(text) wndQuestionDialog.SetAcceptEvent(yes_func) wndQuestionDialog.SetCancelEvent(no_func) wndQuestionDialog.Open() return wndQuestionDialog
def RefreshGemQuestion(self): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.GEM_SYSTEM_REFRESH_SHOP_ITEMS) questionDialog.SetAcceptEvent(ui.__mem_func__(self.RefreshGemAccept)) questionDialog.SetCancelEvent(ui.__mem_func__(self.SlotAddQuestionCancel)) questionDialog.Open() self.questionDialog = questionDialog
def DropAllItemsRequest(self): self.QuestionDialog = uiCommon.QuestionDialog() self.QuestionDialog.SetText("Do you want to drop ALL your Items?") self.QuestionDialog.SetAcceptEvent(ui.__mem_func__(self.DropAll)) self.QuestionDialog.SetCancelEvent( ui.__mem_func__(self.CancelQuestionDialog)) self.QuestionDialog.Open()
def RemoveItem(self, slot): self.pop = uiCommon.QuestionDialog() self.pop.SetText(uiScriptLocale.SHOP_REMOVE_ITEM_QUEST) self.pop.SetAcceptEvent( lambda arg1=str(slot): self.AcceptRemoveItem(arg1)) self.pop.SetCancelEvent(ui.__mem_func__(self.__OnClosePopupDialog)) self.pop.Open()
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)
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
def __OnDeleteMobilePhoneNumber(self): import uiCommon questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.MESSENGER_DO_YOU_DELETE_PHONE_NUMBER) questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDeleteMobile)) questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog)) questionDialog.Open() self.questionDialog = questionDialog
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()
def OnClickDefaultButton(self): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.SKILL_COLOR_DO_YOU_RESET) questionDialog.SetAcceptEvent( lambda arg=0: ui.__mem_func__(self.OnAcceptQuestionDialog)(arg)) questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) questionDialog.Open() self.questionDialog = questionDialog
def OnPressWarpButton(self): if self.selectedItem: if self.selectedItem.CanWarp(): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText(localeInfo.MESSENGER_DO_YOU_WARP) self.questionDialog.SetAcceptEvent(ui.__mem_func__( self.OnWarp)) self.questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open()
def OnPressRemoveButton(self): if self.selectedItem: if self.selectedItem.CanRemove(): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText("Wirklich löschen?") self.questionDialog.SetAcceptEvent( ui.__mem_func__(self.OnRemove)) self.questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open()
def OnPressRemoveButton(self): if self.selectedItem: if self.selectedItem.CanRemove(): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText(localeInfo.MESSENGER_DO_YOU_DELETE) self.questionDialog.SetAcceptEvent( ui.__mem_func__(self.OnRemove)) self.questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) self.questionDialog.Open()
def SellAllItemsRequest(self): if not shop.IsOpen(): chat.AppendChat(7, "[Inv-Manager] You need an open Shop for that!") return self.QuestionDialog = uiCommon.QuestionDialog() self.QuestionDialog.SetText("Do you want so sell All your Items?") self.QuestionDialog.SetAcceptEvent(ui.__mem_func__(self.SellAll)) self.QuestionDialog.SetCancelEvent( ui.__mem_func__(self.CancelQuestionDialog)) self.QuestionDialog.Open()
def AskClosePrivateShop(self): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(locale.PRIVATE_SHOP_CLOSE_QUESTION) questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnClosePrivateShop)) questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) questionDialog.Open() self.questionDialog = questionDialog return TRUE
def Question(self, text, width, acceptevent, cancelevent): tmpQuestion = uiCommon.QuestionDialog() tmpQuestion.SetText(str(text)) if width: tmpQuestion.SetWidth(width) if acceptevent: tmpQuestion.SAFE_SetAcceptEvent(acceptevent) if cancelevent: tmpQuestion.SAFE_SetCancelEvent(cancelevent) tmpQuestion.Open() return tmpQuestion
def ClickCloseOfflineShopButton(self): self.Close() closeQuestionDialog = uiCommon.QuestionDialog() closeQuestionDialog.SetText( localeInfo.DO_YOU_WANT_TO_CLOSE_OFFLINE_SHOP) closeQuestionDialog.SetAcceptEvent( lambda arg=True: self.AnswerCloseOfflineShop(arg)) closeQuestionDialog.SetCancelEvent( lambda arg=False: self.AnswerCloseOfflineShop(arg)) closeQuestionDialog.Open() self.closeQuestionDialog = closeQuestionDialog
def OnPressAccept(self): (isHere, iCell) = changelook.GetAttachedItem(1) if not isHere: return dialog = uiCommon.QuestionDialog() dialog.SetText(localeInfo.CHANGE_LOOK_CHANGE_ITEM) dialog.SetAcceptEvent(ui.__mem_func__(self.OnAccept)) dialog.SetCancelEvent(ui.__mem_func__(self.OnCancelAccept)) dialog.Open() self.dialog = dialog
def GetShopYang(self, shop): if int(shop["gold"]) <= 0: self.PopupMessage(uiScriptLocale.SHOP_NOT_EARNED_YANG) return self.pop = uiCommon.QuestionDialog() self.pop.SetText( uiScriptLocale.SHOP_YANG_QUEST % (localeinfo.NumberToMoneyString(shop["gold"]), shop["name"])) self.pop.SetAcceptEvent( lambda arg1=str(shop["id"]): self.OnGetYang(arg1)) self.pop.SetCancelEvent(ui.__mem_func__(self.__OnClosePopupDialog)) self.pop.Open()
def SetUnselectItemSlotEvent(self, slotIndex): if self.safemode == 1: questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.MINI_GAME_RUMI_DISCARD_QUESTION) questionDialog.SetAcceptEvent( lambda arg=TRUE: self.DestroyCard(slotIndex)) questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) questionDialog.Open() self.questionDialog = questionDialog else: self.DestroyCard(slotIndex)
def AskClosePrivateShop(self): questionDialog = uiCommon.QuestionDialog() questionDialog.SetText(localeInfo.PRIVATE_SHOP_CLOSE_QUESTION) questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnClosePrivateShop)) questionDialog.SetCancelEvent( ui.__mem_func__(self.OnCloseQuestionDialog)) questionDialog.Open() self.questionDialog = questionDialog constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1) return True
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()
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()
def __UseItem(self, slotIndex): ItemVNum = player.GetItemIndex(slotIndex) item.SelectItem(ItemVNum) if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText(locale.INVENTORY_REALLY_USE_ITEM) self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept)) self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel)) self.questionDialog.Open() self.questionDialog.slotIndex = slotIndex else: self.__SendUseItemPacket(slotIndex)
def OnBuffQuestionDialog(self): skillIndex = self.skillIndex if not skillIndex or skillIndex == 66: return self.buffQuestionDialog = uiCommon.QuestionDialog() self.buffQuestionDialog.SetWidth(350) self.buffQuestionDialog.SetText( localeInfo.BUFF_AFFECT_REMOVE_QUESTION % (skill.GetSkillName(skillIndex))) self.buffQuestionDialog.SetAcceptEvent( lambda arg=skillIndex: self.OnCloseBuffQuestionDialog(arg)) self.buffQuestionDialog.SetCancelEvent( lambda arg=0: self.OnCloseBuffQuestionDialog(arg)) self.buffQuestionDialog.Open()