Ejemplo n.º 1
0
def getArmor(level, category, subcategory, quality, slot):
	if quality >= ITEM_QUALITY_HEIRLOOM:
		return 0
	
	if not (1 <= level <= 1000):
		return 0
	
	if slot == INVTYPE_SHIELD:
		dbc = wdbc.get("ItemArmorShield", build=-1)
		total = getattr(dbc[level], qualities[quality])
		return int(floor(total + 0.5))
	
	if slot == INVTYPE_ROBE:
		slot = INVTYPE_CHEST
	
	if category != ITEM_CLASS_ARMOR or not slot:
		return 0
	
	if subcategory not in (ITEM_SUBCLASS_ARMOR_CLOTH, ITEM_SUBCLASS_ARMOR_LEATHER, ITEM_SUBCLASS_ARMOR_MAIL, ITEM_SUBCLASS_ARMOR_PLATE):
		return 0
	
	ArmorLocation = wdbc.get("ArmorLocation", build=-1)
	ItemArmorTotal = wdbc.get("ItemArmorTotal", build=-1)
	ItemArmorQuality = wdbc.get("ItemArmorQuality", build=-1)
	
	total = getattr(ItemArmorTotal[level], types[subcategory])
	_quality = getattr(ItemArmorQuality[level], qualities[quality])
	_slot = getattr(ArmorLocation[slot], types[subcategory])
	
	return int(floor(total * _quality * _slot + 0.5))
Ejemplo n.º 2
0
def getArmor(level, category, subcategory, quality, slot):
    if quality >= ITEM_QUALITY_HEIRLOOM:
        return 0

    if not (1 <= level <= 1000):
        return 0

    if slot == INVTYPE_SHIELD:
        dbc = wdbc.get("ItemArmorShield", build=-1)
        total = getattr(dbc[level], qualities[quality])
        return int(floor(total + 0.5))

    if slot == INVTYPE_ROBE:
        slot = INVTYPE_CHEST

    if category != ITEM_CLASS_ARMOR or not slot:
        return 0

    if subcategory not in (ITEM_SUBCLASS_ARMOR_CLOTH,
                           ITEM_SUBCLASS_ARMOR_LEATHER,
                           ITEM_SUBCLASS_ARMOR_MAIL,
                           ITEM_SUBCLASS_ARMOR_PLATE):
        return 0

    ArmorLocation = wdbc.get("ArmorLocation", build=-1)
    ItemArmorTotal = wdbc.get("ItemArmorTotal", build=-1)
    ItemArmorQuality = wdbc.get("ItemArmorQuality", build=-1)

    total = getattr(ItemArmorTotal[level], types[subcategory])
    _quality = getattr(ItemArmorQuality[level], qualities[quality])
    _slot = getattr(ArmorLocation[slot], types[subcategory])

    return int(floor(total * _quality * _slot + 0.5))
Ejemplo n.º 3
0
	def get(self, id):
		from pywow import wdbc
		itemSparse = wdbc.get("Item-sparse.db2", build=self.build, locale=self.locale)
		item = wdbc.get("Item.db2", build=self.build, locale=self.locale)
		ret = itemSparse[id]
		item = item[id]
		ret.category = item.category
		ret.subcategory = item.subcategory
		return ret
Ejemplo n.º 4
0
def main():
    from pywow.spellstrings import SpellString, WDBCProxy
    from pywow import wdbc

    f = wdbc.get("Spell", BUILD)

    fail, success = 0, 0
    for id, expected in sorted(TESTS[BUILD].items()):
        print "Testing %i..." % (id),
        if abs(id) not in f:
            print "PASS"
            continue

        spell = f[abs(id)]
        if id < 0:
            description = spell.buff_description_enus
        else:
            description = spell.description_enus

        description = SpellString(description).format(spell, proxy=WDBCProxy)

        if description != expected:
            print "FAIL"
            print "Returned:", repr(description)
            print "Expected:", repr(expected)
            #print "Original:", repr(spell.description_enus)
            fail += 1
        else:
            print "OK"
            success += 1

    print "%i/%i tests passed, %i failure" % (success, fail + success, fail)
Ejemplo n.º 5
0
def main():
	from pywow.spellstrings import SpellString, WDBCProxy
	from pywow import wdbc
	
	f = wdbc.get("Spell", BUILD)
	
	fail, success = 0, 0
	for id, expected in sorted(TESTS[BUILD].items()):
		print "Testing %i..." % (id),
		if abs(id) not in f:
			print "PASS"
			continue
		
		spell = f[abs(id)]
		if id < 0:
			description = spell.buff_description_enus
		else:
			description = spell.description_enus
		
		description = SpellString(description).format(spell, proxy=WDBCProxy)
		
		if description != expected:
			print "FAIL"
			print "Returned:", repr(description)
			print "Expected:", repr(expected)
			#print "Original:", repr(spell.description_enus)
			fail += 1
		else:
			print "OK"
			success += 1
	
	print "%i/%i tests passed, %i failure" % (success, fail+success, fail)
Ejemplo n.º 6
0
	def getClassesFromMask(cls, mask):
		from pywow import wdbc
		f = wdbc.get("ChrClasses.dbc", build=-1)
		ret = []
		for id, row in f.items():
			if mask & (2**(id-1)):
				ret.append(ChrClass(id))
		
		if len(ret) < len(f):
			return ret
Ejemplo n.º 7
0
    def getClassesFromMask(cls, mask):
        from pywow import wdbc
        f = wdbc.get("ChrClasses.dbc", build=-1)
        ret = []
        for id, row in f.items():
            if mask & (2**(id - 1)):
                ret.append(ChrClass(id))

        if len(ret) < len(f):
            return ret
Ejemplo n.º 8
0
def main():
	if os.path.exists("Pages.lua.bak"):
		f = open("Pages.lua.bak", "r")
	else:
		f = open("Pages.lua", "r")
	out = f.read()
	f.close()
	os.rename("Pages.lua", "Pages.lua.bak")
	
	db2 = wdbc.get("Item-sparse.db2", -1)
	out = out.replace("--[[__ITEM-SPARSE.DB2__]]", ",\n\t".join(str(k) for k in db2))
	
	f = open("Pages.lua", "w")
	f.write(out)
	f.close()
Ejemplo n.º 9
0
def getDamage(level, category, subcategory, quality, slot, flags, speed):
	if not (1 <= level <= 1000):
		return 0, 0
	
	if category != ITEM_CLASS_WEAPON:
		dps = 0.0
	
	if quality >= ITEM_QUALITY_HEIRLOOM:
		return 0, 0
	
	dbc = getDamageDBC(subcategory, slot, flags)
	if not dbc:
		dps = 0.0
	else:
		dbc = wdbc.get(dbc, build=-1)
		dps = getattr(dbc[level], qualities[quality])
	
	min = int(floor(dps * speed / 1000 * 0.7 + 0.5))
	max = int(floor(dps * speed / 1000 * 1.3 + 0.5))
	return min, max
Ejemplo n.º 10
0
def getDamage(level, category, subcategory, quality, slot, flags, speed):
    if not (1 <= level <= 1000):
        return 0, 0

    if category != ITEM_CLASS_WEAPON:
        dps = 0.0

    if quality >= ITEM_QUALITY_HEIRLOOM:
        return 0, 0

    dbc = getDamageDBC(subcategory, slot, flags)
    if not dbc:
        dps = 0.0
    else:
        dbc = wdbc.get(dbc, build=-1)
        dps = getattr(dbc[level], qualities[quality])

    min = int(floor(dps * speed / 1000 * 0.7 + 0.5))
    max = int(floor(dps * speed / 1000 * 1.3 + 0.5))
    return min, max
Ejemplo n.º 11
0
	"sp":   "SPELL_POWER",
	"spa":  "SPELL_POWER_ARCANE",
	"spfi": "SPELL_POWER_FIRE",
	"spfr": "SPELL_POWER_FROST",
	"sph":  "SPELL_POWER_HOLY",
	"spi":  "SPIRIT",
	"spn":  "SPELL_POWER_NATURE",
	"sps":  "SPELL_POWER_SHADOW",
}

FUNCTIONS = ["ceil", "cond", "eq", "floor", "gte", "gt", "lte", "lt", "max", "min"]

SPELL_DURATION_UNTIL_CANCELLED = "until cancelled"

# XXX get rid of these two calls like this
gtSpellScaling = wdbc.get("gtSpellScaling", build=-1)
spellDBC = wdbc.get("Spell", build=-1)

class VariableNotFound(Exception):
	"""
	Raised when a description variable
	does not exist.
	"""
	pass

class Range(object):
	def __init__(self, min, max):
		self.min = abs(min)
		self.max = abs(max)
	
	def __repr__(self):
Ejemplo n.º 12
0
 def __init__(self, cls):
     from pywow import wdbc
     self.__file = wdbc.get("GlyphProperties.dbc", build=-1)
Ejemplo n.º 13
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("SpellItemEnchantment.dbc", build=-1)
Ejemplo n.º 14
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("Talent.dbc", build=-1)
Ejemplo n.º 15
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("questcache.wdb", build=-1)
Ejemplo n.º 16
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("SkillLine.dbc", build=-1)
		self.spells = wdbc.get("SkillLineAbility.dbc", build=-1)
Ejemplo n.º 17
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("ChrClasses.dbc", build=-1)
Ejemplo n.º 18
0
 def __init__(self, name):
     self.name = name
     self.files = Directory(BASE_DIR + name)
     self.wmo = wdbc.get("WorldMapOverlay", build=BUILD)
Ejemplo n.º 19
0
    def __init__(self, cls):
        from pywow import wdbc

        self.__file = wdbc.get("SpellItemEnchantment.dbc", build=-1)
Ejemplo n.º 20
0
	def get(self, id):
		from pywow import wdbc
		f = wdbc.get("Spell.dbc", build=self.build, locale=self.locale)
		return f[id]
Ejemplo n.º 21
0
 def __init__(self, cls):
     from pywow import wdbc
     self.__file = wdbc.get("ChrClasses.dbc", build=-1)
Ejemplo n.º 22
0
 def __init__(self, cls):
     from pywow import wdbc
     self.__file = wdbc.get("TalentTab.dbc", build=-1)
Ejemplo n.º 23
0
	def openByGet(self, name):
		file = wdbc.get(name, self.args.build)
		self.mainWindow.addTab(file)
		self.mainWindow.setWindowTitle("%s - %s" % (file.file.name, self.name))
Ejemplo n.º 24
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("CurrencyTypes.dbc", build=-1)
Ejemplo n.º 25
0
 def __init__(self, cls):
     from pywow import wdbc
     self.__file = wdbc.get("questcache.wdb", build=-1)
Ejemplo n.º 26
0
 def get(self, id):
     from pywow import wdbc
     f = wdbc.get("Spell.dbc", build=self.build, locale=self.locale)
     return f[id]
Ejemplo n.º 27
0
	def __init__(self, name):
		self.name = name
		self.files = Directory(BASE_DIR + name)
		self.wmo = wdbc.get("WorldMapOverlay", build=BUILD)
Ejemplo n.º 28
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("GlyphProperties.dbc", build=-1)
Ejemplo n.º 29
0
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("ItemSet.dbc", build=-1)