Added a !translate command, utilizing the Google API.

Fix for a few more ValueErrors (printing float > int, without conversation)
This commit is contained in:
2021-10-11 19:52:33 +02:00
parent fc68950ade
commit dea25b05a5
4 changed files with 92 additions and 15 deletions
@@ -304,7 +304,7 @@ class SpecialsController:
[item_id, item_id])
if not item:
return f"Could not find item with ID <highlight>{item_id:d}</highlight>."
return f"Could not find item with ID <highlight>{item_id}</highlight>."
ql = ql or item.highql
@@ -313,7 +313,7 @@ class SpecialsController:
if not low_attributes or not high_attributes:
return f"Could not find weapon information or item is not a weapon for " \
f"ID <highlight>{item_id:d}</highlight>."
f"ID <highlight>{item_id}</highlight>."
weapon_attack = self.util.interpolate_value(ql, {item.lowql: low_attributes.attack_time,
item.highql: high_attributes.attack_time}) / 100
@@ -330,36 +330,36 @@ class SpecialsController:
if high_attributes.aimed_shot:
as_info = self.get_aimed_shot_info(weapon_attack, weapon_recharge, 1)
blob += f"Aimed Shot\n<highlight>{as_info.skill_cap:d}</highlight> skill needed to cap " \
f"Aimed Shot recharge at <highlight>{as_info.hard_cap:d} secs</highlight>\n\n"
blob += f"Aimed Shot\n<highlight>{as_info.skill_cap:.0f}</highlight> skill needed to cap " \
f"Aimed Shot recharge at <highlight>{as_info.hard_cap:.2f} secs</highlight>\n\n"
if high_attributes.burst:
burst_recharge = self.util.interpolate_value(ql, {item.lowql: low_attributes.burst,
item.highql: high_attributes.burst})
burst_info = self.get_burst_info(weapon_attack, weapon_recharge, burst_recharge, 1)
blob += f"Burst Recharge: <highlight>{burst_recharge:d}</highlight>\n" \
blob += f"Burst Recharge: <highlight>{burst_recharge:.2f}</highlight>\n" \
f"<highlight>{burst_info.skill_cap:d}</highlight> skill needed " \
f"to cap Burst recharge at <highlight>{burst_info.hard_cap:d} secs</highlight>\n\n"
f"to cap Burst recharge at <highlight>{burst_info.hard_cap:.2f} secs</highlight>\n\n"
if high_attributes.fast_attack:
fast_attack_info = self.get_fast_attack_info(weapon_attack, 1)
blob += f"Fast Attack\n<highlight>{fast_attack_info.skill_cap:d}</highlight> skill needed " \
blob += f"Fast Attack\n<highlight>{fast_attack_info.skill_cap:.0f}</highlight> skill needed " \
f"to cap Fast Attack recharge at <highlight>{fast_attack_info.hard_cap:.2f} secs</highlight>\n\n"
if high_attributes.fling_shot:
fling_shot_info = self.get_fling_shot_info(weapon_attack, 1)
blob += f"Fling Shot\n<highlight>{fling_shot_info.skill_cap:d}</highlight> skill needed " \
blob += f"Fling Shot\n<highlight>{fling_shot_info.skill_cap}</highlight> skill needed " \
f"to cap Fling Shot recharge at <highlight>{fling_shot_info.hard_cap:.2f} secs</highlight>\n\n"
if high_attributes.full_auto:
full_auto_recharge = self.util.interpolate_value(ql, {item.lowql: low_attributes.full_auto,
item.highql: high_attributes.full_auto})
full_auto_info = self.get_full_auto_info(weapon_attack, weapon_recharge, full_auto_recharge, 1)
blob += f"Full Auto Recharge: <highlight>{full_auto_recharge:d}</highlight>\n" \
f"<highlight>{full_auto_info.skill_cap:d}</highlight> skill needed " \
f"to cap Full Auto recharge at <highlight>{full_auto_info.hard_cap:d} secs</highlight>\n\n"
blob += f"Full Auto Recharge: <highlight>{full_auto_recharge:.2f}</highlight>\n" \
f"<highlight>{full_auto_info.skill_cap:.0f}</highlight> skill needed " \
f"to cap Full Auto recharge at <highlight>{full_auto_info.hard_cap:.2f} secs</highlight>\n\n"
return ChatBlob(f"Weapon Info for {item.name} (QL {ql:d})", blob)
return ChatBlob(f"Weapon Info for {item.name} (QL {ql})", blob)
def get_init_result(self, weapon_attack, weapon_recharge, init_skill):
if init_skill < 1200:
@@ -581,6 +581,6 @@ class SpecialsController:
blob = ""
for i in reversed(range(0, num_steps)):
inits_needed = self.get_inits_needed(i * step_size, weapon_attack, weapon_recharge)
blob += f"DEF >{'=' * i}{']['}{'=' * (num_steps - 1 - i)}< AGG {i * step_size:d}% {inits_needed:d} init \n"
blob += f"DEF [{'=' * i}||{'=' * (num_steps - 1 - i)}] AGG {i * step_size:.0f}% {inits_needed:.0f} init \n"
return blob