Exemplo n.º 1
0
 def reward_recruiter(self):
     """Gives credit to the person who recruited us to a plot, giving xp to both"""
     involvement = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER)
     if involvement.activity_status != PCPlotInvolvement.ACTIVE:
         raise CommandError(
             "You must have joined the plot to reward your recruiter."
         )
     if involvement.recruited_by:
         raise CommandError("You have already rewarded a recruiter.")
     targ = self.get_involvement_by_plot_object(involvement.plot, self.rhs)
     if targ == involvement:
         raise CommandError("You cannot reward yourself.")
     xp = get_recruiter_xp(targ)
     involvement.recruited_by = targ.dompc
     involvement.save()
     targ = targ.dompc.player.roster.character
     targ.adjust_xp(xp)
     targ.player_ob.inform(
         "You have been marked as the recruiter of %s for plot %s, and gained %s xp."
         % (involvement, involvement.plot, xp)
     )
     self.caller.adjust_xp(self.recruited_xp)
     self.msg(
         "You have marked %s as your recruiter. You have both gained xp." % targ.key
     )
Exemplo n.º 2
0
 def connect_to_plot(self, plot):
     """Connects something to a plot with GM notes about it"""
     try:
         name, gm_notes = self.rhs.split("/")
     except (AttributeError, ValueError):
         raise CommandError(
             "You must include a target and notes on how they're connected to the plot."
         )
     if "char" in self.switches:
         target = self.dompc_search(name)
         involvement, created = plot.dompc_involvement.get_or_create(
             dompc=target)
         if created:  # if they're only connected by GM note, they shouldn't know they're connected
             involvement.activity_status = PCPlotInvolvement.NOT_ADDED
             involvement.cast_status = PCPlotInvolvement.TANGENTIAL
     elif "clue" in self.switches:
         target = self.get_by_name_or_id(Clue, name)
         involvement, _ = plot.clue_involvement.get_or_create(clue=target)
     elif "revelation" in self.switches:
         target = self.get_by_name_or_id(Revelation, name)
         involvement, _ = plot.revelation_involvement.get_or_create(
             revelation=target)
     elif "org" in self.switches:
         target = self.get_by_name_or_id(Organization, name)
         involvement, _ = plot.org_involvement.get_or_create(org=target)
     else:
         raise CommandError(
             "You must include the type of object to connect: char, clue, revelation, org."
         )
     if involvement.gm_notes:
         involvement.gm_notes += "\n"
     involvement.gm_notes += gm_notes
     involvement.save()
     self.msg("You have connected %s with %s." % (target, plot))
Exemplo n.º 3
0
 def change_permission_or_set_story(self,
                                    plot,
                                    pc_name,
                                    perm_level=None,
                                    story=None):
     """Changes permissions for a plot for a participant or set their recruiter story"""
     involvement = self.get_involvement_by_plot_object(plot, pc_name)
     if perm_level is not None:
         if involvement.admin_status == PCPlotInvolvement.OWNER:
             raise CommandError("Owners cannot have their status changed.")
         if involvement.cast_status < PCPlotInvolvement.SUPPORTING_CAST and perm_level >= PCPlotInvolvement.GM:
             raise CommandError(
                 "GMs are limited to supporting cast or less.")
         involvement.admin_status = perm_level
         msg = "You have marked %s as a %s." % (
             involvement.dompc, involvement.get_admin_status_display())
     else:
         if story:
             if involvement.admin_status == PCPlotInvolvement.PLAYER:
                 raise CommandError(
                     "They must be set as a recruiter to have a story hook set for how "
                     "someone wanting to become involved in the plot might have heard of them."
                 )
             msg = "You have set %s's story hook that contacts can see to: %s" % (
                 involvement, story)
         else:
             if involvement.admin_status == PCPlotInvolvement.RECRUITER:
                 raise CommandError(
                     "You cannot remove their hook while they are flagged as a recruiter."
                 )
             msg = "You have removed %s's story hook." % involvement
         involvement.recruiter_story = story
     involvement.save()
     self.msg(msg)
Exemplo n.º 4
0
 def add_beat(self, plot):
     """Adds a beat to a plot"""
     from web.character.models import Episode
     from django.core.exceptions import ObjectDoesNotExist
     obj = None
     try:
         if self.check_switches(self.beat_objects):
             object_id, story, notes = self.get_beat_objects()
             if "rpevent" in self.switches:
                 obj = RPEvent.objects.get(id=object_id)
             elif "flashback" in self.switches:
                 obj = Flashback.objects.get(id=object_id)
             else:  # action
                 obj = PlotAction.objects.get(id=object_id)
                 if obj.plot and obj.plot != plot:
                     raise CommandError("That action is already assigned to a different plot.")
                 obj.plot = plot
             if obj.beat:
                 raise CommandError("That object was already associated with beat #%s." % obj.beat.id)
         elif "other" in self.switches:
             story, notes = self.get_beat_objects(get_related_id=False)
         else:
             raise CommandError("You must include the switch of the cause:"
                                " /rpevent, /action, /flashback, or /other.")
     except ObjectDoesNotExist:
         raise CommandError("Did not find an object by that ID.")
     update = plot.updates.create(episode=Episode.objects.last(), desc=story, gm_notes=notes)
     msg = "You have created a new beat for plot %s." % plot
     if obj:
         obj.beat = update
         obj.save()
         msg += " The beat concerns %s(#%s)." % (obj, obj.id)
     self.msg(msg)
Exemplo n.º 5
0
 def do_admin_switches(self):
     """Switches for changing a plot"""
     if self.check_switches(("perm", "storyhook", "cast")):
         attr = ""
         story, new_perm, new_cast = None, None, None
         access_level = PCPlotInvolvement.OWNER
         try:
             name, attr = self.rhs.split("/")
         except (AttributeError, ValueError):
             if self.check_switches(("perm", "cast")):
                 raise CommandError(
                     "You must specify both a name and %s-level." %
                     self.switches[0])
             else:  # attr being a blank string means story being wiped
                 name = self.rhs or ""
         if "storyhook" in self.switches:
             story = attr
             if name.lower() == self.caller.key.lower():
                 access_level = PCPlotInvolvement.RECRUITER
         else:
             perm = attr.lower()
             if perm == "recruiter":
                 new_perm = PCPlotInvolvement.RECRUITER
             elif perm == "gm":
                 new_perm = PCPlotInvolvement.GM
             elif perm == "player":
                 new_perm = PCPlotInvolvement.PLAYER
             elif perm == "required":
                 new_cast = PCPlotInvolvement.REQUIRED_CAST
             elif perm == "main":
                 new_cast = PCPlotInvolvement.MAIN_CAST
             elif perm == "supporting":
                 new_cast = PCPlotInvolvement.SUPPORTING_CAST
             elif perm == "extra":
                 new_cast = PCPlotInvolvement.EXTRA
             else:
                 err = (
                     "You entered '%s'. Valid permission levels: gm, player, or recruiter. "
                     "Valid cast options: required, main, supporting, or extra."
                     % attr)
                 raise CommandError(err)
         plot = self.get_involvement_by_plot_id(
             required_permission=access_level).plot
         self.change_permission_or_set_story(plot, name, new_perm, new_cast,
                                             story)
     elif self.check_switches(("invite", "invitation")):
         if not self.args:
             return self.msg(self.list_invitations())
         plot = self.get_involvement_by_plot_id(
             required_permission=PCPlotInvolvement.RECRUITER).plot
         self.invite_to_plot(plot)
     elif self.check_switches(("rfr", "tag")):
         plot = self.get_involvement_by_plot_id(
             required_permission=PCPlotInvolvement.GM, allow_old=True).plot
         if "rfr" in self.switches:
             self.request_for_review(plot)
         else:
             self.tag_plot_or_beat(plot)
Exemplo n.º 6
0
 def view_our_tagged_stuff(self):
     """Looks up stuff by tag. Without a tag, gives a list of tags we could try."""
     if not self.args:
         tags = ", ".join(("|235%s|n" % ob) for ob in self.caller.roster.known_tags)
         raise CommandError("Search with a tag like: %s" % tags)
     tag = self.get_tag(self.args)
     msg = self.caller.roster.display_tagged_objects(tag)
     if not msg:
         raise CommandError("Nothing found using the '%s' tag." % self.args)
     self.msg(msg)
Exemplo n.º 7
0
 def end_plot(self, plot):
     """Ends a plot"""
     if not self.rhs:
         raise CommandError("You must include a resolution.")
     if plot.resolved:
         raise CommandError("That plot has already been resolved.")
     plot.resolved = True
     plot.end_date = datetime.now()
     plot.save()
     self.msg("You have ended %s." % plot)
Exemplo n.º 8
0
    def junk(self, caller):
        """Checks our ability to be junked out."""

        if self.obj.location != caller:
            raise CommandError("You can only +junk objects you are holding.")
        if self.obj.contents:
            raise CommandError("It contains objects that must first be removed.")
        if not self.junkable:
            raise CommandError("This object cannot be destroyed.")
        self.do_junkout(caller)
Exemplo n.º 9
0
 def create_beat(self):
     """Creates a beat for a plot."""
     involvement = self.get_involvement_by_plot_id(required_permission=PCPlotInvolvement.GM)
     try:
         desc, ooc_notes = self.rhs.split("/")
     except (ValueError, AttributeError):
         raise CommandError("Please use / only to divide IC summary from OOC notes. Usage: <#>=<IC>/<OOC>")
     if not desc or len(desc) < 10:
         raise CommandError("Please have a slightly longer IC summary.")
     plot = involvement.plot
     beat = plot.updates.create(desc=desc, gm_notes=ooc_notes, date=datetime.now())
     self.msg("You have created a new beat for %s, ID: %s." % (plot, beat.id))
Exemplo n.º 10
0
 def split_ic_from_ooc(self, allow_blank_desc=False):
     """Splits rhs and returns an IC description and ooc notes."""
     try:
         desc, ooc_notes = self.rhs.split("/")
     except (ValueError, AttributeError):
         raise CommandError(
             "Please use / only to divide IC summary from OOC notes. Usage: <#>=<IC>/<OOC>"
         )
     if not allow_blank_desc and (not desc or len(desc) < 10):
         raise CommandError("Please have a slightly longer IC summary.")
     if ooc_notes:
         ooc_notes = "|wOOC |c{}|w:|n {}".format(self.caller.key, ooc_notes)
     return desc, ooc_notes
Exemplo n.º 11
0
 def get_involvement_by_plot_id(self, required_permission=PCPlotInvolvement.OWNER, plot_id=None, allow_old=False):
     """Gets one of caller's plot-involvement object based on plot ID"""
     try:
         if not plot_id:
             plot_id = self.lhslist[0]
         involvement = self.involvement_queryset.get(plot_id=plot_id)
         if involvement.admin_status < required_permission:
             raise CommandError("You lack the required permission for that plot.")
     except (PCPlotInvolvement.DoesNotExist, TypeError, ValueError, IndexError):
         raise CommandError("No plot found by that ID.")
     if involvement.plot.resolved and not allow_old:
         raise CommandError("That plot has been resolved.")
     return involvement
Exemplo n.º 12
0
 def change_permission_or_set_story(
     self, plot, pc_name, new_perm=None, new_cast=None, story=None
 ):
     """Changes permissions for a plot for a participant or set their recruiter story"""
     involvement = self.get_involvement_by_plot_object(plot, pc_name)
     success = ["You have "]
     gm_err = "GMs are limited to supporting cast; they should not star in stories they're telling."
     if new_perm is not None:
         if involvement.admin_status == PCPlotInvolvement.OWNER:
             raise CommandError("Owners cannot have their admin permission changed.")
         if (
             involvement.cast_status < PCPlotInvolvement.SUPPORTING_CAST
             and new_perm == PCPlotInvolvement.GM
         ):
             raise CommandError(gm_err)
         involvement.admin_status = new_perm
         success.append(
             "marked %s as a %s."
             % (involvement.dompc, involvement.get_admin_status_display())
         )
     elif new_cast is not None:
         if (
             new_cast < PCPlotInvolvement.SUPPORTING_CAST
             and involvement.admin_status == PCPlotInvolvement.GM
         ):
             raise CommandError(gm_err)
         involvement.cast_status = new_cast
         success.append(
             "added %s to the plot's %s members."
             % (involvement.dompc, involvement.get_cast_status_display())
         )
     else:
         if story:
             if involvement.admin_status == PCPlotInvolvement.PLAYER:
                 raise CommandError(
                     "They must be set as a recruiter to have a story hook set for how "
                     "someone wanting to become involved in the plot might have heard of them."
                 )
             success.append(
                 "set %s's story hook that contacts can see to: %s"
                 % (involvement, story)
             )
         else:
             if involvement.admin_status == PCPlotInvolvement.RECRUITER:
                 raise CommandError(
                     "You cannot remove their hook while they are flagged as a recruiter."
                 )
             success.append("removed %s's story hook." % involvement)
         involvement.recruiter_story = story
     involvement.save()
     self.msg("".join(success))
Exemplo n.º 13
0
 def add_object_to_beat(self):
     """Adds an object that was the origin of a beat for a plot"""
     # clues and revelations aren't part of beats but using /add is a convenience for players
     if self.check_switches(("clue", "addclue")):
         return self.add_clue()
     if self.check_switches(("revelation", "addrevelation")):
         return self.add_revelation()
     if self.check_switches(("theory", "addtheory")):
         return self.add_theory()
     beat = self.get_beat(self.rhs, cast_access=True)
     if "rpevent" in self.switches:
         if self.called_by_staff:
             qs = RPEvent.objects.all()
         else:
             qs = self.caller.dompc.events.all()
         try:
             added_obj = qs.get(id=self.lhs)
         except RPEvent.DoesNotExist:
             raise CommandError("You did not attend an RPEvent with that ID.")
     elif "action" in self.switches:
         if self.called_by_staff:
             qs = PlotAction.objects.all()
         else:
             qs = self.caller.past_participated_actions
         try:
             added_obj = qs.get(id=self.lhs)
         except PlotAction.DoesNotExist:
             raise CommandError("No action by that ID found for you.")
         if added_obj.plot and added_obj.plot != beat.plot:
             raise CommandError("That action is already part of another plot.")
         added_obj.plot = beat.plot
     elif "gemit" in self.switches:
         if not self.called_by_staff:
             raise CommandError("Only staff can add gemits to plot beats.")
         try:
             added_obj = StoryEmit.objects.get(id=self.lhs)
         except StoryEmit.DoesNotExist:
             raise CommandError("No gemit found by that ID.")
     elif "flashback" in self.switches:
         if self.called_by_staff:
             qs = Flashback.objects.all()
         else:
             qs = self.caller.roster.flashbacks.all()
         try:
             added_obj = qs.get(id=self.lhs)
         except Flashback.DoesNotExist:
             raise CommandError("No flashback by that ID.")
     else:
         raise CommandError("You must specify a type of object to add to a beat.")
     if added_obj.beat:
         oldbeat = added_obj.beat
         if oldbeat.desc or oldbeat.gm_notes:
             raise CommandError("It already has been assigned to a plot beat.")
         else:  # It was a temporary placeholder to associate an RPEvent with a plot
             oldbeat.delete()
     added_obj.beat = beat
     added_obj.save()
     self.msg(
         "You have added %s to beat(ID: %d) of %s." % (added_obj, beat.id, beat.plot)
     )
Exemplo n.º 14
0
 def create_plot(self):
     """Creates a new plot"""
     parent = None
     try:
         name, summary, desc = self.lhs.split("/")
     except (AttributeError, ValueError):
         raise CommandError(
             "Must include a name, summary, and a description for the plot."
         )
     if self.rhs:
         parent = self.get_by_name_or_id(Plot, self.rhs)
     plot = Plot.objects.create(
         name=name,
         desc=desc,
         parent_plot=parent,
         usage=Plot.GM_PLOT,
         start_date=datetime.now(),
         headline=summary,
     )
     if parent:
         self.msg(
             "You have created a new subplot of %s: %s (#%s)."
             % (parent, plot, plot.id)
         )
     else:
         self.msg("You have created a new gm plot: %s (#%s)." % (plot, plot.id))
Exemplo n.º 15
0
 def submit_form(self):
     form = self.form
     if not form.is_valid():
         raise CommandError(form.display_errors())
     new_object = form.save()
     self.msg("%s(#%s) created." % (new_object, new_object.id))
     self.caller.attributes.remove(self.form_attribute)
Exemplo n.º 16
0
 def func(self):
     """Executes plot command"""
     try:
         if not self.switches or "old" in self.switches or "timeline" in self.switches:
             return self.do_plot_displays()
         if "createbeat" in self.switches:
             return self.create_beat()
         if "add" in self.switches:
             return self.add_object_to_beat()
         if "search" in self.switches:
             return self.view_our_tagged_stuff()
         if self.check_switches(self.admin_switches):
             return self.do_admin_switches()
         if "accept" in self.switches:
             return self.accept_invitation()
         if "leave" in self.switches:
             return self.leave_plot()
         if "pitch" in self.switches:
             return self.make_plot_pitch()
         if "findcontact" in self.switches:
             return self.find_contact()
         if "rewardrecruiter" in self.switches:
             return self.reward_recruiter()
         if "addclue" in self.switches:
             return self.add_clue()
         if "addrevelation" in self.switches:
             return self.add_revelation()
         raise CommandError("Unrecognized switch.")
     except CommandError as err:
         self.msg(err)
Exemplo n.º 17
0
 def func(self):
     """Executes plot command"""
     try:
         if not self.switches or "old" in self.switches or "timeline" in self.switches:
             self.do_plot_displays()
         elif "createbeat" in self.switches:
             self.create_beat()
         elif "editbeat" in self.switches:
             self.edit_beat()
         elif self.check_switches(
             ("add", "addclue", "addrevelation", "addtheory")):
             self.add_object_to_beat()
         elif "search" in self.switches:
             self.view_our_tagged_stuff()
         elif self.check_switches(self.admin_switches):
             self.do_admin_switches()
         elif self.check_switches(
             ("accept", "outstanding", "invitations", "invites")):
             self.accept_invitation()
         elif "leave" in self.switches:
             self.leave_plot()
         elif "pitch" in self.switches:
             self.make_plot_pitch()
         elif "findcontact" in self.switches:
             self.find_contact()
         elif "rewardrecruiter" in self.switches:
             self.reward_recruiter()
         else:
             raise CommandError("Unrecognized switch.")
     except CommandError as err:
         self.msg(err)
     else:
         self.mark_command_used()
Exemplo n.º 18
0
 def leave_plot(self):
     """Marks us inactive on a plot or deletes an invitation"""
     involvement = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER)
     if involvement.activity_status == PCPlotInvolvement.LEFT:
         raise CommandError("You have already left that plot.")
     involvement.leave_plot()
     self.msg("You have left %s." % involvement.plot)
Exemplo n.º 19
0
    def get_tag(self, tag_text=None):
        """Searches for a tag."""
        from web.character.models import SearchTag

        if not tag_text:
            raise CommandError("What tag are we using?")
        return self.get_by_name_or_id(SearchTag, tag_text)
Exemplo n.º 20
0
 def view_beat(self):
     """Views a beat for a plot"""
     plot = self.get_involvement_by_plot_id(required_permission=PCPlotInvolvement.PLAYER).plot
     try:
         beat = plot.beats.get(id=self.rhs)
     except (PlotUpdate.DoesNotExist, ValueError):
         raise CommandError("No beat found by that ID.")
     self.msg(beat.display_beat())
Exemplo n.º 21
0
 def add_revelation(self):
     """Adds a revelation to an existing plot"""
     plot = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER).plot
     try:
         rev_id, notes = self.rhs.split("/", 1)
     except (AttributeError, ValueError):
         raise CommandError("You must include a revelation ID and notes of how the clue is related to the plot.")
     try:
         revelation = self.caller.roster.revelations.get(id=rev_id)
     except (Clue.DoesNotExist, TypeError, ValueError):
         raise CommandError("No revelation by that ID.")
     rev_plot_inv, created = revelation.plot_involvement.get_or_create(plot=plot)
     if not created:
         raise CommandError("That revelation is already related to that plot.")
     rev_plot_inv.gm_notes = notes
     rev_plot_inv.save()
     self.msg("You have associated revelation '%s' with plot '%s'." % (revelation, plot))
Exemplo n.º 22
0
 def add_clue(self):
     """Adds a clue to an existing plot"""
     plot = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER).plot
     try:
         clue_id, notes = self.rhs.split("/", 1)
     except (AttributeError, ValueError):
         raise CommandError("You must include a clue ID and notes of how the clue is related to the plot.")
     try:
         clue = self.caller.roster.clues.get(id=clue_id)
     except (Clue.DoesNotExist, TypeError, ValueError):
         raise CommandError("No clue by that ID.")
     clue_plot_inv, created = clue.plot_involvement.get_or_create(plot=plot)
     if not created:
         raise CommandError("That clue is already related to that plot.")
     clue_plot_inv.gm_notes = notes
     clue_plot_inv.save()
     self.msg("You have associated clue '%s' with plot '%s'." % (clue, plot))
Exemplo n.º 23
0
 def set_property_for_dompc(self, plot, field, choices_attr):
     """Sets a property for someone involved in a plot"""
     choices = dict_from_choices_field(PCPlotInvolvement, choices_attr)
     try:
         name, choice = self.rhslist
     except (TypeError, ValueError):
         raise CommandError("You must give both a name and a value.")
     choice = choice.lower()
     try:
         choice_value = choices[choice]
     except KeyError:
         keys = [ob[1].lower() for ob in getattr(PCPlotInvolvement, choices_attr)]
         raise CommandError("Choice must be one of: %s." % ", ".join(keys))
     dompc = self.dompc_search(name)
     involvement, _ = plot.dompc_involvement.get_or_create(dompc=dompc)
     setattr(involvement, field, choice_value)
     involvement.save()
     self.msg("You have set %s as a %s in %s." % (dompc, getattr(involvement, "get_%s_display" % field)(), plot))
Exemplo n.º 24
0
 def add_theory(self):
     """Adds a theory to an existing plot"""
     plot = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER).plot
     try:
         theory = self.caller.player_ob.known_theories.get(id=self.rhs)
     except (Theory.DoesNotExist, TypeError, ValueError):
         raise CommandError("No theory by that ID.")
     plot.theories.add(theory)
     self.msg("You have associated theory '%s' with plot '%s'." % (theory, plot))
Exemplo n.º 25
0
 def invite_to_plot(self, plot: Plot):
     """Invites a player to join a plot"""
     try:
         name, status = self.rhslist
     except (TypeError, ValueError):
         raise CommandError("Must provide both a name and a status for invitation.")
     dompc = self.dompc_search(name)
     plot.add_dompc(dompc, status=status.lower(), recruiter=self.caller.key)
     self.msg("You have invited %s to join %s." % (dompc, plot))
Exemplo n.º 26
0
 def do_admin_switches(self):
     """Switches for changing a plot"""
     if "perm" in self.switches or "storyhook" in self.switches:
         attr = ""
         access_level = PCPlotInvolvement.OWNER
         try:
             name, attr = self.rhs.split("/")
         except (AttributeError, ValueError):
             if "perm" in self.switches:
                 raise CommandError(
                     "You must specify both a name and a permission level.")
             else:  # attr being a blank string means it's being wiped
                 name = self.rhs or ""
         if "storyhook" in self.switches:
             story = attr
             perm_status = None
             if name.lower() == self.caller.key.lower():
                 access_level = PCPlotInvolvement.RECRUITER
         else:
             story = None
             perm = attr.lower()
             if perm == "recruiter":
                 perm_status = PCPlotInvolvement.RECRUITER
             elif perm == "gm":
                 perm_status = PCPlotInvolvement.GM
             elif perm == "player":
                 perm_status = PCPlotInvolvement.PLAYER
             else:
                 raise CommandError(
                     "Permission must be 'gm', 'player', or 'recruiter'.")
         plot = self.get_involvement_by_plot_id(
             required_permission=access_level).plot
         self.change_permission_or_set_story(plot, name, perm_status, story)
     elif "invite" in self.switches:
         plot = self.get_involvement_by_plot_id(
             required_permission=PCPlotInvolvement.RECRUITER).plot
         self.invite_to_plot(plot)
     elif "rfr" in self.switches or "tag" in self.switches:
         plot = self.get_involvement_by_plot_id(
             required_permission=PCPlotInvolvement.GM, allow_old=True).plot
         if "rfr" in self.switches:
             self.request_for_review(plot)
         else:
             self.tag_plot_or_beat(plot)
Exemplo n.º 27
0
 def accept_invitation(self):
     """Accepts an invitation to a plot"""
     if not self.lhs:
         return self.msg(self.list_invitations())
     try:
         invite = self.invitations.get(plot_id=self.lhs)
     except (PCPlotInvolvement.DoesNotExist, ValueError):
         raise CommandError("No invitation by that ID.\n%s" % self.list_invitations())
     invite.accept_invitation(self.rhs)
     self.msg("You have joined %s (Plot ID: %s)" % (invite.plot, invite.plot.id))
Exemplo n.º 28
0
 def find_contact(self):
     """Displays a list of recruiter whom the holder of a plot hook can contact to become involved"""
     try:
         secret = self.caller.messages.get_clue_by_id(self.lhs)
     except (ValueError, KeyError, TypeError):
         raise CommandError("You do not have a secret by that number.")
     msg = "People you can talk to for more plot involvement with your secret:\n"
     for recruiter in secret.clue.recruiters.exclude(plot__in=self.caller.dompc.active_plots).distinct():
         msg += "\n{c%s{n: %s\n" % (str(recruiter), recruiter.recruiter_story)
     self.msg(msg)
Exemplo n.º 29
0
 def get_beat_objects(self, get_related_id=True):
     """Gets the items for our beat or raises an error"""
     try:
         if get_related_id:
             obj_id, story, notes = self.rhs.split("/")
             return obj_id, story, notes
         else:
             story, notes = self.rhs.split("/")
             return story, notes
     except (TypeError, ValueError):
         raise CommandError("You must include a story and GM Notes.")
Exemplo n.º 30
0
 def make_plot_pitch(self):
     """Creates a ticket about a plot idea"""
     try:
         name, summary, desc, gm_notes = self.lhs.split("/", 3)
     except ValueError:
         raise CommandError("You must provide a name, a one-line summary, desc, and notes for GMs separated by '/'.")
     parent_plot = None
     if self.rhs:
         parent_plot = self.get_involvement_by_plot_id(PCPlotInvolvement.PLAYER, plot_id=self.rhs).plot
     ticket = create_plot_pitch(desc, gm_notes, name, parent_plot, summary, self.caller.player_ob)
     self.msg("You made a pitch to staff for a new plot. Ticket ID: %s." % ticket.id)