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 OnCloseQuestionDialog(self): if not self.questionDialog: return self.questionDialog.Close() self.questionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(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)
def AnswerRemoveItem(self, flag): if (flag): pos = self.questionDialog.pos net.SendRemoveOfflineShopItem(pos) self.questionDialog.Close() self.questionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) self.Refresh()
def AnswerBuyItem(self, flag): if (flag): pos = self.itemBuyQuestionDialog.pos net.SendOfflineShopBuyPacket(pos) self.itemBuyQuestionDialog.Close() self.itemBuyQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
def AnswerBuyItem(self, flag): if flag: pos = self.itemBuyQuestionDialog.pos GFHhg54GHGhh45GHGH.SendShopBuyPacket(pos) self.itemBuyQuestionDialog.Close() self.itemBuyQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
def Close(self): global g_isEditingOfflineShop g_isEditingOfflineShop = False if (self.questionDialog): self.questionDialog.Close() self.questionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) self.title = "" self.Hide()
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 Close(self): if self.itemBuyQuestionDialog: self.itemBuyQuestionDialog.Close() self.itemBuyQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) if self.questionDialog: self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.tooltipItem.HideToolTip() self.Hide()
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 Close(self): if app.ENABLE_OFFLINE_SHOP: if constInfo.SHOP_MOVE_FLAG: return if self.itemBuyQuestionDialog: self.itemBuyQuestionDialog.Close() self.itemBuyQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) if self.questionDialog: self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.tooltipItem.HideToolTip() self.Hide()
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(localeInfo.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 constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1) else: self.__SendUseItemPacket(slotIndex)
def Close(self, isDestroy=False): self.interface.SetOnTopWindow(player.ON_TOP_WND_NONE) if not isDestroy: self.interface.RefreshMarkInventoryBag() if self.itemBuyQuestionDialog: self.itemBuyQuestionDialog.Close() self.itemBuyQuestionDialog = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0) self.OnCloseQuestionDialog() shop.Close() net.SendShopEndPacket() self.CancelShopping() self.tooltipItem.HideToolTip() self.Hide()
def AskBuyItem(self, slotPos): itemIndex = shop.GetOfflineShopItemID(slotPos) itemPrice = shop.GetOfflineShopItemPrice(slotPos) itemCount = shop.GetOfflineShopItemCount(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)
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)
def SellAttachedItem(self): import constInfo, chat if constInfo.BlockItemsSystem["Block"] == 1: chat.AppendChat(1, "Sicherheitssystem Aktiviert.") return if shop.IsPrivateShop(): mouseModule.mouseController.DeattachObject() return attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedCount = mouseModule.mouseController.GetAttachedItemCount() if localeInfo.IsBRAZIL() == 0: attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex( ) if fgGHGjjFHJghjfFG1545gGG.SLOT_TYPE_INVENTORY == attachedSlotType or fgGHGjjFHJghjfFG1545gGG.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType: if localeInfo.IsBRAZIL(): itemIndex = fgGHGjjFHJghjfFG1545gGG.GetItemIndex( attachedSlotPos) item.SelectItem(itemIndex) else: 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 = fgGHGjjFHJghjfFG1545gGG.INVENTORY if localeInfo.IsBRAZIL() == 0: if fgGHGjjFHJghjfFG1545gGG.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType: itemtype = fgGHGjjFHJghjfFG1545gGG.DRAGON_SOUL_INVENTORY if fgGHGjjFHJghjfFG1545gGG.IsValuableItem(itemtype, 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( 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 __OnClosePopupDialog(self): self.pop = None constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)