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 Open(self, price, free): self.ItemIcon = None self.Wheel.SetRotation(0) self.FreeSpin.SetText(str(free)) self.Yang.SetText(localeInfo.NumberToMoneyString(price)) self.Board.Show() self.Show()
def __CanRefineStep (self, vnum): ds_info = self.__GetDragonSoulTypeInfo(vnum) if DragonSoulRefineWindow.INVALID_DRAGON_SOUL_INFO == ds_info: self.__PopUp(localeInfo.DRAGON_SOUL_IS_NOT_DRAGON_SOUL) return FALSE if self.currentRecipe: ds_type, grade, step, strength = ds_info cur_refine_ds_type, cur_refine_grade, cur_refine_step, cur_refine_strength = self.currentRecipe["ds_info"] if not (cur_refine_ds_type == ds_type and cur_refine_grade == grade and cur_refine_step == step): self.__PopUp(localeInfo.DRAGON_SOUL_INVALID_DRAGON_SOUL) return FALSE # 강화 창에 처음 아이템을 올리는 경우, 재료에 관한 정보가 없다. # 용혼석 강화가, 레시피를 가지고 시작하는 것이 아니라, 강화창에 처음 올리는 아이템이 무엇이냐에 따라, # 무엇을 강화하고, 재료가 무엇인지(이하 레시피)가 정해진다. # 레시피가 없다면, 처음 올린 아이템이라 생각하고, vnum을 바탕으로 레시피를 셋팅. else: self.currentRecipe = self.__GetRefineStepRecipe(vnum) if self.currentRecipe: self.refineSlotLockStartIndex = self.currentRecipe["need_count"] self.wndMoney.SetText(localeInfo.NumberToMoneyString(self.currentRecipe["fee"])) return TRUE else: # 강화 정보 셋팅에 실패하면 올릴 수 없는 아이템으로 판단. self.__PopUp(localeInfo.DRAGON_SOUL_CANNOT_REFINE) return FALSE
def __CanRefineStrength (self, vnum): # 용혼석인 경우, 더 이상 strength 강화를 할 수 없는지 체크해야함. if self.__IsDragonSoul(vnum): ds_type, grade, step, strength = self.__GetDragonSoulTypeInfo(vnum) import dragon_soul_refine_settings if strength >= dragon_soul_refine_settings.dragon_soul_refine_info[ds_type]["strength_max_table"][grade][step]: self.__PopUp(localeInfo.DRAGON_SOUL_CANNOT_REFINE_MORE) return FALSE else: return TRUE # strength 강화의 경우, refine_recipe가 용혼석의 종류가 아닌, 강화석의 종류에 따라 달라진다. # 따라서 용혼석이 아니라면, # 이미 레시피가 있는 경우는, 강화석이 강화창에 있다는 것이므로, return FALSE # 레시피가 없는 경우는, 강화석인지 확인하고, 레시피를 셋팅한다. else: if self.currentRecipe: self.__PopUp(localeInfo.DRAGON_SOUL_IS_NOT_DRAGON_SOUL) return FALSE else: refineRecipe = self.__GetRefineStrengthInfo(vnum) if refineRecipe: self.currentRecipe = refineRecipe self.wndMoney.SetText(localeInfo.NumberToMoneyString(self.currentRecipe["fee"])) return TRUE else: # 레시피를 셋팅할 수 없는 경우 self.__PopUp(localeInfo.DRAGON_SOUL_NOT_DRAGON_SOUL_REFINE_STONE) return FALSE
def Show(self, price): self.__LoadWindow() self.Reset() self.Price.SetText(localeInfo.NumberToMoneyString(price)) ui.ScriptWindow.Show(self) self.SetCenterPosition() self.SetTop()
def Open(self): self.SetCenterPosition() self.SetTop() self.currentMoneyLine.SetText(localeInfo.NumberToMoneyString(player.GetCurrentOfflineShopMoney())) self.requiredMoneyLine.SetText("0") self.Show()
def __ShowToolTip(self, slot): if self.tooltipItem: self.tooltipItem.ClearToolTip() self.tooltipItem.SetCannotUseItemForceSetDisableColor(0) if int(slot) in constInfo.gift_items.keys(): it = constInfo.gift_items[int(slot)] #self.tooltipItem.AppendTextLine("|cff18BB00|h[Item ID: %d]|h|r" % (it["id"])) #self.tooltipItem.AppendSpace(5) if it["vnum"] == 1: self.tooltipItem.ClearToolTip() self.tooltipItem.SetTitle( localeInfo.NumberToMoneyString(it["count"])) self.tooltipItem.AppendDescription( uiScriptLocale.GIFT_MONEY_DESC, 26) self.tooltipItem.AppendDescription(item.GetItemSummary(), 26, 0xffBEB47D) self.tooltipItem.ShowToolTip() else: self.tooltipItem.AddItemData(int(it["vnum"]), it["sockets"], it["attrs"]) self.tooltipItem.AppendTextLine( "|cff18BB00|h[%s %s]|h|r" % (uiScriptLocale.GIFT_FROM, it["give"])) self.tooltipItem.AppendSpace(5) self.tooltipItem.AppendTextLine( "|cff18BB00|h[%s %s]|h|r" % (uiScriptLocale.GIFT_REASON, it["reason"])) self.tooltipItem.AppendSpace(5) else: self.tooltipItem.ClearToolTip() self.tooltipItem.HideToolTip()
def __SelectRefineItemSlot(self, selectedSlotPos): if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1: return try: if not selectedSlotPos in self.refineItemInfo: # 새로운 아이템을 강화창에 올리는 작업. if mouseModule.mouseController.isAttached(): attachedSlotType = mouseModule.mouseController.GetAttachedType() attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber() attachedItemCount = mouseModule.mouseController.GetAttachedItemCount() attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex() mouseModule.mouseController.DeattachObject() if uiPrivateShopBuilder.IsBuildingPrivateShop(): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP) return attachedInvenType = player.SlotTypeToInvenType(attachedSlotType) if player.INVENTORY == attachedInvenType and player.IsEquipmentSlot(attachedSlotPos): return if player.INVENTORY != attachedInvenType and player.DRAGON_SOUL_INVENTORY != attachedInvenType: return self.AutoSetItem((attachedInvenType, attachedSlotPos), 1) return elif mouseModule.mouseController.isAttached(): return attachedInvenType, attachedSlotPos, attachedItemCount = self.refineItemInfo[selectedSlotPos] selectedItemVnum = player.GetItemIndex(attachedInvenType, attachedSlotPos) # 강화창에서 삭제 및 원래 인벤의 아이템 카운트 회복 invenType, invenPos, itemCount = self.refineItemInfo[selectedSlotPos] remainCount = player.GetItemCount(invenType, invenPos) player.SetItemCount(invenType, invenPos, remainCount + itemCount) del self.refineItemInfo[selectedSlotPos] # 강화창이 비었다면, 초기화 if not self.refineItemInfo: self.__Initialize() else: item.SelectItem(selectedItemVnum) # 없앤 아이템이 강화석이었다면 강화 레피시 초기화 if (item.ITEM_TYPE_MATERIAL == item.GetItemType() \ and (item.MATERIAL_DS_REFINE_NORMAL <= item.GetItemSubType() and item.GetItemSubType() <= item.MATERIAL_DS_REFINE_HOLLY)): self.currentRecipe = {} self.wndMoney.SetText(localeInfo.NumberToMoneyString(0)) # 용혼석이었다면, # strength강화가 아닌 경우, 강화창에 다른 용혼석이 남아있으므로, 레시피를 초기화하면 안됨. # strength강화의 경우, 강화 레시피는 강화석에 종속된 것이므로 다른 처리할 필요가 없음. else: pass except Exception, e: import dbg dbg.TraceError("Exception : __SelectRefineItemSlot, %s" % e)
def __OnValueUpdate(self): ui.EditLine.OnIMEUpdate(self.inputValue) text = self.inputValue.GetText() for i in xrange(len(text)): if not text[i].isdigit(): text = text[0:i] + text[i + 1:] self.inputValue.SetText(text) self.moneyText.SetText(self.moneyHeaderText + localeInfo.NumberToMoneyString(text))
def Show(self): self.currentRefineType = self.REFINE_TYPE_GRADE self.wndMoney.SetText(localeInfo.NumberToMoneyString(0)) self.refineChoiceButtonDict[self.REFINE_TYPE_GRADE].Down() self.refineChoiceButtonDict[self.REFINE_TYPE_STEP].SetUp() self.refineChoiceButtonDict[self.REFINE_TYPE_STRENGTH].SetUp() self.Refresh() ui.ScriptWindow.Show(self)
def Open(self): self.SetCenterPosition() self.SetTop() net.SendRefreshOfflineShopMoney() self.currentMoneyLine.SetText( localeInfo.NumberToMoneyString( player.GetCurrentOfflineShopMoney())) self.requiredMoneyLine.SetText("0") chat.AppendChat(chat.CHAT_TYPE_INFO, "Her 5 saniyede para yenilenecektir.") self.Show()
def OnUpdate(self): try: if (app.GetTime() < self.updateTime + 5): return self.updateTime = app.GetTime() net.SendRefreshOfflineShopMoney() self.currentMoneyLine.SetText( localeInfo.NumberToMoneyString( player.GetCurrentOfflineShopMoney())) except: pass
def __OnClickDownBetButton(self): # Check valid bet index. if self.betIndex <= 1: return # Try to decrease bet value. try: # Decrease bet value and set text value. self.betIndex -= 1 self.betValue.SetText(localeInfo.NumberToMoneyString(SLOT_MACHINE_BET_VALUES[self.betIndex])) except KeyError: return
def __OnValueUpdate(self): ui.EditLine.OnIMEUpdate(self.inputValue) text = self.inputValue.GetText() money = 0 if text and text.isdigit(): try: money = int(text) except ValueError: money = 199999999 self.moneyText.SetText(self.moneyHeaderText + localeInfo.NumberToMoneyString(money))
def __Initialize(self): self.currentRecipe = {} self.refineItemInfo = {} self.resultItemInfo = {} if self.REFINE_TYPE_STRENGTH == self.currentRefineType: self.refineSlotLockStartIndex = 2 else: self.refineSlotLockStartIndex = 1 for i in xrange(self.refineSlotLockStartIndex): self.wndRefineSlot.HideSlotBaseImage(i) self.wndMoney.SetText(localeInfo.NumberToMoneyString(0))
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)
"x_count": 8, "y_count": 3, "x_step": 32, "y_step": 32, "image": "d:/ymir work/ui/public/Slot_Base.sub" }, ## Print { "name": "NeedMoney", "type": "text", "x": 20, "y": 468, "width": 200, "horizontal_align": "right", "text_horizontal_align": "right", "text": localeInfo.NumberToMoneyString(0), }, { "name": "contentScrollbar", "type": "thin_scrollbar", "x": 253, "y": 38, "size": 315, }, # Cube Result List. 1 ~ 3 { "name": "result1board", "type": "window",
def UpdateInfo(self, gold, itemVnum, count): if self.needMoney: self.needMoney.SetText(localeInfo.NumberToMoneyString(gold)) self.Refresh()
{ "name": "NeedMoney", "type": "text", "x": 0, "y": SIZE_Y - 48, "horizontal_align": "center", "text_horizontal_align": "center", "text": localeInfo.COMB_COST % (localeInfo.NumberToMoneyString(NEED_MONEY)), }, ## Button { "name": "accept_button", "type": "button", "x": SIZE_X / 2 - 65, "y": SIZE_Y - 30, "text": uiScriptLocale.OK, "default_image": "d:/ymir work/ui/public/middle_button_01.sub", "over_image": "d:/ymir work/ui/public/middle_button_02.sub", "down_image": "d:/ymir work/ui/public/middle_button_03.sub", },
def RefreshMoney(self): self.wndMoney.SetText( localeInfo.NumberToMoneyString(shop.GetMoney()))
def __LoadWindow(self): if self.isLoaded == 1: return self.isLoaded = 1 try: pyScrLoader = ui.PythonScriptLoader() pyScrLoader.LoadScriptFile(self, "uiscript/dragonsoulrefinewindow.py") except: import exception exception.Abort("dragonsoulrefinewindow.LoadWindow.LoadObject") try: wndRefineSlot = self.GetChild("RefineSlot") wndResultSlot = self.GetChild("ResultSlot") self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close)) self.refineChoiceButtonDict = { self.REFINE_TYPE_GRADE : self.GetChild("GradeButton"), self.REFINE_TYPE_STEP: self.GetChild("StepButton"), self.REFINE_TYPE_STRENGTH : self.GetChild("StrengthButton"), } self.doRefineButton = self.GetChild("DoRefineButton") self.wndMoney = self.GetChild("Money_Slot") except: import exception exception.Abort("DragonSoulRefineWindow.LoadWindow.BindObject") ## Item Slots wndRefineSlot.SetOverInItemEvent(ui.__mem_func__(self.__OverInRefineItem)) wndRefineSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOutItem)) wndRefineSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__SelectRefineEmptySlot)) wndRefineSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.__SelectRefineItemSlot)) wndRefineSlot.SetUseSlotEvent(ui.__mem_func__(self.__SelectRefineItemSlot)) wndRefineSlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__SelectRefineItemSlot)) wndResultSlot.SetOverInItemEvent(ui.__mem_func__(self.__OverInResultItem)) wndResultSlot.SetOverOutItemEvent(ui.__mem_func__(self.__OverOutItem)) self.wndRefineSlot = wndRefineSlot self.wndResultSlot = wndResultSlot ## Button self.refineChoiceButtonDict[self.REFINE_TYPE_GRADE].SetToggleDownEvent(self.__ToggleDownGradeButton) self.refineChoiceButtonDict[self.REFINE_TYPE_STEP].SetToggleDownEvent(self.__ToggleDownStepButton) self.refineChoiceButtonDict[self.REFINE_TYPE_STRENGTH].SetToggleDownEvent(self.__ToggleDownStrengthButton) self.refineChoiceButtonDict[self.REFINE_TYPE_GRADE].SetToggleUpEvent(lambda : self.__ToggleUpButton(self.REFINE_TYPE_GRADE)) self.refineChoiceButtonDict[self.REFINE_TYPE_STEP].SetToggleUpEvent(lambda : self.__ToggleUpButton(self.REFINE_TYPE_STEP)) self.refineChoiceButtonDict[self.REFINE_TYPE_STRENGTH].SetToggleUpEvent(lambda : self.__ToggleUpButton(self.REFINE_TYPE_STRENGTH)) self.doRefineButton.SetEvent(self.__PressDoRefineButton) ## Dialog self.wndPopupDialog = uiCommon.PopupDialog() self.currentRefineType = self.REFINE_TYPE_GRADE self.refineItemInfo = {} self.resultItemInfo = {} self.currentRecipe = {} self.wndMoney.SetText(localeInfo.NumberToMoneyString(0)) self.refineChoiceButtonDict[self.REFINE_TYPE_GRADE].Down() self.__Initialize()
def SetMoney(self, money): self.MoneyBoard["text"].SetText(localeInfo.NumberToMoneyString(money))
def RefreshSafeboxMoney(self): if app.ENABLE_OFFLINE_SHOP: self.wndMoney.SetText(localeInfo.NumberToMoneyString(safebox.GetMoney()))
def RefreshStatus(self): money = player.GetElk() self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
def Refresh(self): self.RefreshOwnerSlot() self.RefreshTargetSlot() self.OwnerMoney.SetText( localeInfo.NumberToMoneyString(exchange.GetElkFromSelf())) self.TargetMoney.SetText( localeInfo.NumberToMoneyString(exchange.GetElkFromTarget())) if exchange.GetAcceptFromSelf() == True: if not app.ENABLE_NEW_EXCHANGE_WINDOW: self.OwnerAcceptLight.Down() else: self.OwnerSlot.SetSlotBaseImage( "d:/ymir work/ui/public/slot_base.sub", 0.3500, 0.8500, 0.3500, 1.0) self.LogsDropList.AppendItem( self.Item( self, localeInfo.NEW_EXCHANGE_YOU_ACCEPT % (str( (time.strftime("[%H:%M:%S]")))), 0)) else: if self.AcceptButton.IsDown() == True: self.LogsDropList.AppendItem( self.Item( self, localeInfo.NEW_EXCHANGE_YOU_ABORT % (str( (time.strftime("[%H:%M:%S]")))), 0)) self.AcceptButton.Enable() self.AcceptButton.SetUp() if not app.ENABLE_NEW_EXCHANGE_WINDOW: self.OwnerAcceptLight.SetUp() else: self.OwnerSlot.SetSlotBaseImage( "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0) if exchange.GetAcceptFromTarget() == True: if not app.ENABLE_NEW_EXCHANGE_WINDOW: self.TargetAcceptLight.Down() else: self.TargetAcceptButton.Down() self.TargetSlot.SetSlotBaseImage( "d:/ymir work/ui/public/slot_base.sub", 0.3500, 0.8500, 0.3500, 1.0) self.LogsDropList.AppendItem( self.Item( self, localeInfo.NEW_EXCHANGE_ACCEPT % (str((time.strftime("[%H:%M:%S]"))), exchange.GetNameFromTarget()), 0)) else: if not app.ENABLE_NEW_EXCHANGE_WINDOW: self.TargetAcceptLight.SetUp() else: if self.TargetAcceptButton.IsDown() == True: self.LogsDropList.AppendItem( self.Item( self, localeInfo.NEW_EXCHANGE_ABORT % (str((time.strftime("[%H:%M:%S]"))), exchange.GetNameFromTarget()), 0)) self.TargetAcceptButton.SetUp() self.TargetSlot.SetSlotBaseImage( "d:/ymir work/ui/public/slot_base.sub", 1.0, 1.0, 1.0, 1.0)
def OnUpdate(self): net.SendRefreshOfflineShopMoney() self.currentMoneyLine.SetText(localeInfo.NumberToMoneyString(player.GetCurrentOfflineShopMoney()))