def func(self):
        caller = self.caller

        if self.args is None or not utils.dbref(self.args):
            caller.msg("A puzzle recipe's #dbref must be specified")
            return

        puzzle = search.search_script(self.args)
        if not puzzle or not inherits_from(puzzle[0], PuzzleRecipe):
            caller.msg("Invalid puzzle %r" % (self.args))
            return

        puzzle = puzzle[0]
        caller.msg("Puzzle Recipe %s(%s) '%s' found.\nSpawning %d parts ..." %
                   (puzzle.name, puzzle.dbref, puzzle.db.puzzle_name,
                    len(puzzle.db.parts)))

        for proto_part in puzzle.db.parts:
            part = spawn(proto_part)[0]
            caller.msg(
                "Part %s(%s) spawned and placed at %s(%s)" %
                (part.name, part.dbref, part.location, part.location.dbref))
            part.tags.add(puzzle.db.puzzle_name,
                          category=_PUZZLES_TAG_CATEGORY)
            part.db.puzzle_name = puzzle.db.puzzle_name

        caller.msg("Puzzle armed |gsuccessfully|n.")
Beispiel #2
0
def get_weather(position):
    '''
    return the wind and current
    '''
    matches = search.search_script("WorldWind")
    print "\nmatches = %s, type = %s" % (matches, type(matches))
    if not matches:
        print "No match in the db for WorldWind.\n"
        return
    WorldWind = matches[0]
    string = "wind is %s\ncurrent is %s"
    wind = WorldWind.return_wind((1, 1))
    current = WorldWind.return_current((1, 1))
    print string % (str(wind), str(current))
    return (wind, current)
Beispiel #3
0
def get_weather(position):
    '''
    return the wind and current
    '''
    matches = search.search_script("WorldWind")
    print "\nmatches = %s, type = %s" % (matches, type(matches))
    if not matches:
        print "No match in the db for WorldWind.\n"
        return
    WorldWind = matches[0]
    string = "wind is %s\ncurrent is %s"
    wind = WorldWind.return_wind((1, 1))
    current = WorldWind.return_current((1, 1))
    print string % (str(wind), str(current))
    return (wind, current)
Beispiel #4
0
    def func(self):
        matches = search.search_script("WorldWind")
        print "\nmatches = %s, type = %s" % (matches, type(matches))
        if not matches:
            print "No match in the db for WorldWind.\n"
            return
        WorldWind = matches[0]
        print "WorldWind type = %s\n\n" % type(WorldWind)

        if not self.args:
            (direction, speed) = WorldWind.return_current((1, 1))
            string = "The current is flowing %s degrees at %s knots"
            self.caller.msg(string % (direction, speed))
            return
        elif self.switches:
            print "Do stuff with switches"
        else:
            print "This suggests there were some arguments"
            [direction, speed] = self.lhs.split()
            # now set the wind on the object
            string = "You set the current to %s degrees at %s knots"
            self.caller.msg(string % (direction, speed))
            WorldWind.set_current(direction, speed)
Beispiel #5
0
    def func(self):
        matches = search.search_script("WorldWind")
        print "\nmatches = %s, type = %s" % (matches, type(matches))
        if not matches:
            print "No match in the db for WorldWind.\n"
            return
        WorldWind = matches[0]
        print "WorldWind type = %s\n\n" % type(WorldWind)

        if not self.args:
            (direction, speed) = WorldWind.return_current((1, 1))
            string = "The current is flowing %s degrees at %s knots"
            self.caller.msg(string % (direction, speed))
            return
        elif self.switches:
            print "Do stuff with switches"
        else:
            print "This suggests there were some arguments"
            [direction, speed] = self.lhs.split()
            # now set the wind on the object
            string = "You set the current to %s degrees at %s knots"
            self.caller.msg(string % (direction, speed))
            WorldWind.set_current(direction, speed)
    def func(self):
        self._USAGE = "Usage: @puzzleedit[/switches] <dbref>[/attribute = <value>]"
        caller = self.caller

        if not self.lhslist:
            caller.msg(self._USAGE)
            return

        if "/" in self.lhslist[0]:
            recipe_dbref, attr = self.lhslist[0].split("/")
        else:
            recipe_dbref = self.lhslist[0]

        if not utils.dbref(recipe_dbref):
            caller.msg("A puzzle recipe's #dbref must be specified.\n" +
                       self._USAGE)
            return

        puzzle = search.search_script(recipe_dbref)
        if not puzzle or not inherits_from(puzzle[0], PuzzleRecipe):
            caller.msg("%s(%s) is not a puzzle" %
                       (puzzle[0].name, recipe_dbref))
            return

        puzzle = puzzle[0]
        puzzle_name_id = "%s(%s)" % (puzzle.name, puzzle.dbref)

        if "delete" in self.switches:
            if not (puzzle.access(caller, "control")
                    or puzzle.access(caller, "delete")):
                caller.msg("You don't have permission to delete %s." %
                           puzzle_name_id)
                return

            puzzle.delete()
            caller.msg("%s was deleted" % puzzle_name_id)
            return

        elif "addpart" in self.switches:
            objs = self._get_objs()
            if objs:
                added = self._add_parts(objs, puzzle)
                caller.msg("%s were added to parts" % (", ".join(added)))
            return

        elif "delpart" in self.switches:
            objs = self._get_objs()
            if objs:
                removed = self._remove_parts(objs, puzzle)
                caller.msg("%s were removed from parts" % (", ".join(removed)))
            return

        elif "addresult" in self.switches:
            objs = self._get_objs()
            if objs:
                added = self._add_results(objs, puzzle)
                caller.msg("%s were added to results" % (", ".join(added)))
            return

        elif "delresult" in self.switches:
            objs = self._get_objs()
            if objs:
                removed = self._remove_results(objs, puzzle)
                caller.msg("%s were removed from results" %
                           (", ".join(removed)))
            return

        else:
            # edit attributes

            if not (puzzle.access(caller, "control")
                    or puzzle.access(caller, "edit")):
                caller.msg("You don't have permission to edit %s." %
                           puzzle_name_id)
                return

            if attr == "use_success_message":
                puzzle.db.use_success_message = self.rhs
                caller.msg("%s use_success_message = %s\n" %
                           (puzzle_name_id, puzzle.db.use_success_message))
                return
            elif attr == "use_success_location_message":
                puzzle.db.use_success_location_message = self.rhs
                caller.msg(
                    "%s use_success_location_message = %s\n" %
                    (puzzle_name_id, puzzle.db.use_success_location_message))
                return
            elif attr == "mask":
                puzzle.db.mask = tuple(self.rhslist)
                caller.msg("%s mask = %r\n" % (puzzle_name_id, puzzle.db.mask))
                return