示例#1
0
    def __Refresh(self):
        print "__Refresh"

        isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(
            self.potionType)

        amountPercent = (float(currentAmount) / totalAmount) * 100.0
        grade = math.ceil(amountPercent / 20)

        if 5.0 > amountPercent:
            grade = 0

        if 80.0 < amountPercent:
            grade = 4
            if 90.0 < amountPercent:
                grade = 5

        fmt = self.filePath + "%.2d.dds"
        fileName = fmt % grade

        print self.potionType, amountPercent, fileName

        try:
            self.LoadImage(fileName)
        except:
            import dbg
            dbg.TraceError(
                "AutoPotionImage.__Refresh(potionType=%d) - LoadError %s" %
                (self.potionType, fileName))

        self.SetScale(0.7, 0.7)

        self.toolTip.ClearToolTip()

        if player.AUTO_POTION_TYPE_HP == type:
            self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_HP)
        else:
            self.toolTip.SetTitle(localeInfo.TOOLTIP_AUTO_POTION_SP)

        self.toolTip.AppendTextLine(localeInfo.TOOLTIP_AUTO_POTION_REST %
                                    (amountPercent))
        self.toolTip.ResizeToolTip()
示例#2
0
	def UpdateAutoPotionDescription(self):		
		
		potionType = 0
		if self.affect == chr.NEW_AFFECT_AUTO_HP_RECOVERY:
			potionType = player.AUTO_POTION_TYPE_HP
		else:
			potionType = player.AUTO_POTION_TYPE_SP	
		
		isActivated, currentAmount, totalAmount, slotIndex = player.GetAutoPotionInfo(potionType)
		
		#print "UpdateAutoPotionDescription ", isActivated, currentAmount, totalAmount, slotIndex
		
		amountPercent = 0.0
		
		try:
			amountPercent = (float(currentAmount) / totalAmount) * 100.0		
		except:
			amountPercent = 100.0
		
		self.SetToolTipText(self.description % amountPercent, 0, 40)