<filename>commands/wilderness.py<gh_stars>1-10
"""
Special commands to be used in the wilderness.

"""
from world.utils import maptools
from contrib.wilderness import WildernessRoom
from commands.command import MuxCommand as Command


class CmdOrienta(Command):
    """
    Restituisce quando possibile una visione più ampia della wild.

    """

    key = "orienta"
    aliases = ["ori"]
    locks = "cmd:all() and wild()"
    help_category = "Wild"

    def func(self):
        caller = self.caller
        location = caller.location
        brightness = location.get_brightness()

        if type(location) == WildernessRoom:
            terrain_mask = caller.ndb.wilderness.terrain
            iconset_mask = caller.ndb.wilderness.iconset
            coordinates = caller.ndb.wilderness.itemcoordinates[caller]

            ##############################
            # ADATTARE A NUOVO SIST.ATTR #
            ##############################
            bonus = caller.db.perception_bonus if caller.db.perception_bonus else 1
            radius = int(6 * min(bonus, 2.0))

            if radius <= 4 or brightness < 4:
                string = "Al momento risulterebbe inutile."
                caller.msg(string)
                return

            string = "Ti guardi attorno, scrutando il paesaggio..."
            caller.msg(string)

            view = maptools.return_minimap(
                terrain_mask, iconset_mask, coordinates, caller, radius=radius
            )
            caller.msg(view, options={"raw": True, "client_raw": True})
        else:
            string = "Dovresti trovarti all'esterno per utilizzare questo comando."
            caller.msg(string)
