<commit_before># -*- coding: utf-8 -*-
"""
Glyphs
 - GlyphProperties.dbc
"""

from .. import *
from ..globalstrings import *


class Glyph(Model):
	MAJOR = 0
	MINOR = 1
	PRIME = 2
	
	def getTypeText(self):
		return {
			self.MINOR: MINOR_GLYPH,
			self.MAJOR: MAJOR_GLYPH,
			self.PRIME: PRIME_GLYPH,
		}.get(self.obj.type, "")

class GlyphTooltip(Tooltip):
	def __init__(self, obj, renderer=None):
		self.obj = obj
		self.renderer = renderer
		self.keys = []
		self.values = []
	
	def render(self):
		
		self.append("name", self.obj.getName())
		self.append("type", self.obj.getTypeText())
		self.append("description", self.obj.getDescription(), YELLOW)
		
		ret = self.values
		self.values = []
		return ret

class GlyphProxy(object):
	"""
	WDBC proxy for glyphs
	"""
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("GlyphProperties.dbc", build=-1)
	
	def get(self, id):
		from ..spells import Spell, SpellProxy
		Spell.initProxy(SpellProxy)
		row = self.__file[id]
		self.spell = Spell(row._raw("spell"))
		return row
	
	def getDescription(self, row):
		return "blah"
		return self.spell.getDescription()
	
	def getName(self, row):
		return self.spell.name_enus
	
	def getSpellIcon(self, row):
		return self.spell.getIcon()<commit_msg>game/glyphs: Add Glyph.getAllForClass() and Glyph.getAllSpells(), properly initialize the tooltip and add Glyph.getSpell()<commit_after># -*- coding: utf-8 -*-
"""
Glyphs
 - GlyphProperties.dbc
"""

from .. import *
from ..globalstrings import *


class Glyph(Model):
	MAJOR = 0
	MINOR = 1
	PRIME = 2
	SKILL_GLYPHS = 810
	
	@classMethod
	def getAllSpells(cls):
		from ..skills import Skill, SkillProxy
		Skill.initProxy(SkillProxy)
		return Skill(SKILL_GLYPHS).getSpells()
	
	@classmethod
	def getAllForClass(cls, chrClass):
		spells = cls.getAllSpells()
		ret = []
		for spell in spells:
			glyph = spell.getGlyphLearned()
			if glyph and glyph.getSpell().getGlyphInfo() == chrClass:
				ret.append(spell)
		return ret
	
	def getTypeText(self):
		return {
			self.MINOR: MINOR_GLYPH,
			self.MAJOR: MAJOR_GLYPH,
			self.PRIME: PRIME_GLYPH,
		}.get(self.obj.type, "")

class GlyphTooltip(Tooltip):
	def tooltip(self):
		
		self.append("name", self.obj.getName())
		self.append("type", self.obj.getTypeText())
		self.append("description", self.obj.getDescription(), YELLOW)
		
		ret = self.values
		self.values = []
		return ret

class GlyphProxy(object):
	"""
	WDBC proxy for glyphs
	"""
	def __init__(self, cls):
		from pywow import wdbc
		self.__file = wdbc.get("GlyphProperties.dbc", build=-1)
	
	def get(self, id):
		from ..spells import Spell, SpellProxy
		Spell.initProxy(SpellProxy)
		row = self.__file[id]
		self.spell = Spell(row._raw("spell"))
		return row
	
	def getDescription(self, row):
		return self.spell.getDescription()
	
	def getName(self, row):
		return self.spell.name_enus
	
	def getSpell(self, row):
		return self.spell
	
	def getSpellIcon(self, row):
		return self.spell.getIcon()
{'fraction_non_alphanumeric': 0.1393939393939394, 'fraction_numerical': 0.004377104377104377, 'mean_word_length': 3.854575163398693, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1323025', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1103, 'n_words': 241}