import math
from core.chat_blob import ChatBlob
from core.command_param_types import Int
from core.db import DB
from core.decorators import instance, command
from core.dict_object import DictObject
from core.text import Text
@instance()
class OverequippedController:
def inject(self, registry):
self.db: DB = registry.get_instance("db")
self.text: Text = registry.get_instance("text")
@command(command="oe", params=[Int("skill_level")], access_level="member",
description="Show the current time in every timezone")
def oe_command(self, _, skill_level):
oe = self.get_oe_vals(skill_level)
blob = f"With a skill requirement of {skill_level}, you will be\n"
blob += f"Out of OE: {oe.oe100low} or higher\n"
blob += f"75%: {oe.oe75low} to {oe.oe100low - 1}\n"
blob += f"50%: {oe.oe50low} to {oe.oe75low - 1}\n"
blob += f"25%: {oe.oe25low} to {oe.oe50low - 1}\n"
blob += f"0%: {oe.oe25low - 1} or lower\n\n"
blob += f"With a personal skill of {skill_level}, you can use up to\n"
blob += f"Out of OE: {oe.oe100} or lower\n"
blob += f"75%: {oe.oe100 + 1} to {oe.oe75}\n"
blob += f"50%: {oe.oe75 + 1} to {oe.oe50}\n"
blob += f"25%: {oe.oe50 + 1} to {oe.oe25}\n"
blob += f"0%: {oe.oe25 - 1} or higher\n"
return ChatBlob("%d - %d - %d" % (oe.oe100low, skill_level, oe.oe100), blob)
def get_oe_vals(self, skill_level):
return DictObject({
"oe100": int(math.floor(skill_level / 0.8)),
"oe100low": int(math.floor(skill_level * 0.8)),
"oe75": int(math.floor(skill_level / 0.6)),
"oe75low": int(math.floor(skill_level * 0.6)),
"oe50": int(math.floor(skill_level / 0.4)),
"oe50low": int(math.floor(skill_level * 0.4)),
"oe25": int(math.floor(skill_level / 0.2)),
"oe25low": int(math.floor(skill_level * 0.2))})