textutils.py (1614B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\agentinteraction\textutils.py 2 import re 3 from eveservices.menu import GetMenuService 4 from utillib import KeyVal 5 6 def fix_text(text): 7 text = text.replace('\r\n', '') 8 text = text.replace('\n', '') 9 text = text.strip() 10 while text.endswith('<br>'): 11 text = text[:-len('<br>')] 12 13 text = text.replace('font color = ', 'font color=') 14 text = text.replace('font color =', 'font color=') 15 text = fix_color_tags(text) 16 return text 17 18 19 def fix_color_tags(text): 20 color_format1 = '#[a-fA-F0-9]{6}' 21 color_format2 = '"#[a-fA-F0-9]{6}"' 22 for cf in (color_format1, color_format2): 23 colors_to_fix = re.findall('<font color=%s>' % cf, text) 24 for c in colors_to_fix: 25 match = re.search(cf, c) 26 if match: 27 color_value = match.group() 28 color_value = color_value.strip('"').strip('#') 29 text = text.replace(c, '<font color=0xFF%s>' % color_value) 30 31 return text 32 33 34 def get_menu_for_item(reward_item): 35 if reward_item.is_blueprint_copy(): 36 bpDdata = sm.GetService('blueprintSvc').GetBlueprintTypeCopy(reward_item.type_id, original=False, runsRemaining=reward_item.get_runs_remaining(), materialEfficiency=reward_item.get_material_level(), timeEfficiency=reward_item.get_productivity_level()) 37 abstractInfo = KeyVal(fullBlueprintData=bpDdata) 38 else: 39 abstractInfo = None 40 return GetMenuService().GetMenuFromItemIDTypeID(None, reward_item.type_id, includeMarketDetails=True, abstractInfo=abstractInfo)