def summon_help_boxes(self, titles, offsets): if not self.help_boxes: self.help_boxes.append( InfoMenu.Help_Box( 'Name', (28 - 15, 40), InfoMenu.create_help_box(cf.WORDS['Name_desc']))) for idx in range(len(titles)): pos = (offsets[idx] + 64 - 15 - 2, 40) self.help_boxes.append( InfoMenu.Help_Box( titles[idx], pos, InfoMenu.create_help_box(cf.WORDS[titles[idx] + '_desc'])))
def create_help_box(self): if self.weapon or self.spell: font1 = GC.FONT['text_blue'] font2 = GC.FONT['text_yellow'] if self.weapon: first_line_text = [' ', self.weapon.LVL, ' Mt ', str(self.weapon.MT), ' Hit ', str(self.weapon.HIT)] if cf.CONSTANTS['crit']: first_line_text += [' Crit ', str(self.crit) if self.crit is not None else '--'] if self.weight: first_line_text += [' Wt ', str(self.weight)] first_line_text += [' Rng ', self.strRNG] first_line_font = [font1, font1, font2, font1, font2, font1] if cf.CONSTANTS['crit']: first_line_font += [font2, font1] if self.weight: first_line_font += [font2, font1] first_line_font += [font2, font1] elif self.spell: first_line_text = [' ', self.spell.LVL] first_line_font = [font1, font1] if self.damage is not None: first_line_text += [' Mt ', str(self.damage)] first_line_font += [font2, font1] if self.hit is not None: first_line_text += [' Hit ', str(self.hit)] first_line_font += [font2, font1] if cf.CONSTANTS['crit'] and self.crit is not None: first_line_text += [' Crit ', str(self.crit)] first_line_font += [font2, font1] first_line_text += [' Rng ', self.strRNG] first_line_font += [font2, font1] first_line_length = max(font1.size(''.join(first_line_text))[0] + (16 if self.icon else 0) + 4, 112) # 112 was 96 if self.desc: output_desc_lines = TextChunk.line_wrap(TextChunk.line_chunk(self.desc), first_line_length, GC.FONT['convo_black']) else: output_desc_lines = '' size_x = first_line_length + 16 size_y = 24 + len(output_desc_lines)*16 help_surf = MenuFunctions.CreateBaseMenuSurf((size_x, size_y), 'MessageWindowBackground') self.drawType(help_surf, 4, 4) # Actually blit first line word_index = 20 if self.icon else 4 for index, word in enumerate(first_line_text): first_line_font[index].blit(word, help_surf, (word_index, 4)) word_index += first_line_font[index].size(word)[0] for index, line in enumerate(output_desc_lines): GC.FONT['convo_black'].blit(''.join(line), help_surf, (4, GC.FONT['convo_black'].height*index + 4 + 16)) return help_surf else: return InfoMenu.create_help_box(self.desc)
def get_help_box(self): if self.weapon or self.spell: font1 = FONT['text_blue'] font2 = FONT['text_yellow'] if self.weapon: first_line_text = [' ', self.weapon.LVL, ' Mt ', str(self.weapon.MT), ' Hit ', str(self.weapon.HIT)] if self.WT: first_line_text += [' Wt ', str(self.WT)] first_line_text += [' Rng ', self.strRNG] first_line_font = [font1, font1, font2, font1, font2, font1] if self.WT: first_line_font += [font2, font1] first_line_font += [font2, font1] elif self.spell: first_line_text = [' ', self.spell.LVL] first_line_font = [font1, font1] if self.damage is not None: first_line_text += [' Mt ', str(self.damage)] first_line_font += [font2, font1] if self.hit is not None: first_line_text += [' Hit ', str(self.hit)] first_line_font += [font2, font1] first_line_text += [' Rng ', self.strRNG] first_line_font += [font2, font1] first_line_length = max(font1.size(''.join(first_line_text))[0] + 16 * len(self.TYPE) + 4, 96) output_desc_lines = MenuFunctions.line_wrap(MenuFunctions.line_chunk(self.desc), first_line_length, FONT['convo_black']) size_x = first_line_length + 16 size_y = 24 + len(output_desc_lines)*16 help_surf = MenuFunctions.CreateBaseMenuSurf((size_x, size_y), 'MessageWindowBackground') self.drawType(help_surf, 4, 4) # Actually blit first line word_index = 4 + 16 * len(self.TYPE) for index, word in enumerate(first_line_text): first_line_font[index].blit(word, help_surf, (word_index, 4)) word_index += first_line_font[index].size(word)[0] for index, line in enumerate(output_desc_lines): FONT['convo_black'].blit(''.join(line), help_surf, (4, FONT['convo_black'].height*index + 4 + 16)) return help_surf else: return InfoMenu.create_help_box(self.desc)
def get_help_box(self): return InfoMenu.create_help_box(self.desc)