def __AppendAffect(self, affect): if self.affectImageDict.has_key(affect): return try: affectData = self.AFFECT_DATA_DICT[affect] except KeyError: return name = affectData[0] filename = affectData[1] skillIndex = fgGHGjjFHJghjfFG1545gGG.AffectIndexToSkillIndex(affect) if 0 != skillIndex: name = skill.GetSkillName(skillIndex) image = AffectImage() image.SetParent(self) image.SetSkillAffectFlag(TRUE) image.SetSkillIndex(skillIndex) try: image.LoadImage(filename) except: pass image.SetToolTipText(name, 0, 40) image.SetScale(0.7, 0.7) image.Show() self.affectImageDict[affect] = image
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()
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()
def OnUpdate(self): self.updatesSinceColorUpdate = self.updatesSinceColorUpdate + 1 if self.bgColorPickerButton.IsIn(): xBtn, yBtn = self.bgColorPickerButton.GetGlobalPosition() btnHeight = self.bgColorPickerButton.GetHeight() xMousePos, yMousePos = wndMgr.GetMousePosition() if yMousePos - yBtn < btnHeight - 1: xMouse = xMousePos - xBtn yMouse = yMousePos - yBtn if xMouse > 255: xMouse = 255 if yMouse > 255: yMouse = 255 self.pickerPos = (xMouse, yMouse) if self.updatesSinceColorUpdate > 5: self.ChangeColor(xMouse, yMouse) if self.toolTip: try: r, g, b = self.GetRGBColor() hexCode = "#{:02x}{:02x}{:02x}".format( int(r), int(g), int(b)) toolTipText = localeInfo.SKILL_COLOR_PICK_TOOLTIP % ( skill.GetSkillName(self.skillIndex, 0), hexCode) arglen = len(str(toolTipText)) self.toolTip.ClearToolTip() self.toolTip.SetThinBoardSize(5 * arglen) self.toolTip.AppendTextLine( toolTipText, 0xffffff00) self.toolTip.Show() except: return # skill.GetSkillName - Failed to find skill index else: self.toolTip.Hide() elif self.bg2ColorPresetToolTip.IsIn(): if self.colorPresetToolTip: self.colorPresetToolTip.Show() else: self.colorPresetToolTip.Hide() elif self.bg2CustomColorToolTip.IsIn(): if self.customColorToolTip: self.customColorToolTip.Show() else: self.customColorToolTip.Hide() else: if not self.colorPresetPreview: if self.genColor and self.bgColorBar: self.bgColorBar.SetColor( grp.GenerateColor(self.genColor[0], self.genColor[1], self.genColor[2], 1.0)) else: self.bgColorBar.SetColor(grp.GenerateColor(0, 0, 0, 0.0)) if self.toolTip: self.toolTip.Hide() if self.colorPresetToolTip: self.colorPresetToolTip.Hide() if self.customColorToolTip: self.customColorToolTip.Hide()