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))
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
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)
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)
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
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
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()
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
"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):
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("GlyphProperties.dbc", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("SpellItemEnchantment.dbc", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("Talent.dbc", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("questcache.wdb", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("SkillLine.dbc", build=-1) self.spells = wdbc.get("SkillLineAbility.dbc", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("ChrClasses.dbc", build=-1)
def __init__(self, name): self.name = name self.files = Directory(BASE_DIR + name) self.wmo = wdbc.get("WorldMapOverlay", build=BUILD)
def get(self, id): from pywow import wdbc f = wdbc.get("Spell.dbc", build=self.build, locale=self.locale) return f[id]
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("TalentTab.dbc", build=-1)
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))
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("CurrencyTypes.dbc", build=-1)
def __init__(self, cls): from pywow import wdbc self.__file = wdbc.get("ItemSet.dbc", build=-1)