def render(self): contexts = get_item(self.context.item_id) for context in contexts: if context.get('name'): self.context.title = context['name'] self.context.slot = context['slot'] self.context.armor_class = context['armor_class'] self.context.weapon_type = context['weapon_type'] self.context.icon = context['icon'] self.context.klass = context['klass'] break self.context.contexts = contexts self.context.reindexObject() IStatusMessage(self.request).addStatusMessage(_(u"Item updated"),"info") self.request.response.redirect(self.context.absolute_url())
def render(self): character = get_character(self.context.region,self.context.server,self.context.title) self.context.thumbnail = character['thumbnail'] if not self.context.gear: self.context.gear = set() for slot,dummy in getFieldsInOrder(IGearSlots): if slot in character['items']: # offhand might not exist gear_item = '%d_%s' % (character['items'][slot]['id'], character['items'][slot]['context']) if 562 in character['items'][slot]['bonusLists']: gear_item += ' (w)' if 565 in character['items'][slot]['bonusLists']: gear_item += ' (s)' self.context.gear.add(gear_item) self.context.reindexObject() IStatusMessage(self.request).addStatusMessage(_(u"Character updated"),"info") self.request.response.redirect(self.context.absolute_url())
def render(self): self.context.update_character() IStatusMessage(self.request).addStatusMessage(_(u"Character updated"),"info") self.request.response.redirect(self.context.absolute_url())
"Hellfire Assault", "Iron Reaver", "Kormrok", "Hellfire High Council", "Kilrogg Deadeye", "Gorefiend", "Shadow-Lord Iskar", "Socrethar the Eternal", "Tyrant Velhari", "Fel Lord Zakuun", "Xhul'horac", "Mannoroth", "Archimonde", ] loot_sources = SimpleVocabulary( [SimpleTerm(value=v, title=_(v)) for v in hellfire] + [ SimpleTerm(value=u"Legendary", title=_(u"Legendary")), SimpleTerm(value=u"Blackrock Foundry", title=_(u"Blackrock Foundry")), SimpleTerm(value=u"other", title=_(u"Other")), ] ) class ICharacter(form.Schema): title = schema.TextLine(title=_(u"Name"), required=False) guild = schema.TextLine(title=_(u"Guild"), required=False) server = schema.TextLine(title=_(u"Server"), required=False) region = schema.TextLine(title=_(u"Region"), required=False) thumbnail = schema.TextLine(title=_(u"Thumbnail"), required=False) gear = schema.Set(title=_(u"Looted Gear"), required=False, value_type=schema.TextLine())
def get_api(url): base_url = url try: blizz = json.load(urlopen(url)) except (URLError, IOError): try: url = base_url.replace('https://us.api.battle.net/wow','https://warcrafttools.com/bnet/wow') blizz = json.load(urlopen(url)) except: url = 'http://www.esoth.com/proxyw?u='+base_url blizz = json.load(urlopen(url)) return blizz specs = SimpleVocabulary( [SimpleTerm(value=u'blood-dk', title=_(u'Death Knight (Blood)')), SimpleTerm(value=u'frost-dk', title=_(u'Death Knight (Frost/Unholy)')), SimpleTerm(value=u'guardian-druid', title=_(u'Druid (Guardian)')), SimpleTerm(value=u'feral-druid', title=_(u'Druid (Feral)')), SimpleTerm(value=u'balance-druid', title=_(u'Druid (Balance)')), SimpleTerm(value=u'restoration-druid', title=_(u'Druid (Restoration)')), SimpleTerm(value=u'hunter', title=_(u'Hunter')), SimpleTerm(value=u'mage', title=_(u'Mage')), SimpleTerm(value=u'mistweaver-monk', title=_(u'Monk (Mistweaver)')), SimpleTerm(value=u'brewmaster-monk', title=_(u'Monk (Brewmaster)')), SimpleTerm(value=u'windwalker-monk', title=_(u'Monk (Windwalker)')), SimpleTerm(value=u'holy-paladin', title=_(u'Paladin (Holy)')), SimpleTerm(value=u'protection-paladin', title=_(u'Paladin (Protection)')), SimpleTerm(value=u'retribution-paladin', title=_(u'Paladin (Retribution)')), SimpleTerm(value=u'holy-priest', title=_(u'Priest (Holy/Discipline)')), SimpleTerm(value=u'shadow-priest', title=_(u'Priest (Shadow)')),