def get_area_by_name(self, name=None):
        from base.models import Area

        area = Area.get(self.temp_key, name=name, player=self.player)

        if area is None:
            data = world.get_area(room_name=name)

            if data is None:
                return None

            area = Area.new(self.player, data, temp_key=self.temp_key)

        return area
Exemple #2
0
    def get_neighbor(self, d):
        if d == 'n' or d == 'north':
            name = self.area_north
        elif d == 'e' or d == 'east':
            name = self.area_east
        elif d == 's' or d == 'south':
            name = self.area_south
        elif d == 'w' or d == 'west':
            name = self.area_west
        else:
            return

        area = Area.get(self.temp_key, name=name, player=self.player)

        if area is None:
            data = world.get_area(room_name=name)
            area = Area.new(self.player, data)
            area.put()

        return area