/** * eightball.C: A Magic 8 Ball. Oh noes! * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005-2006 William Pitcock et al * Rights to this code are documented in doc/pod/license.pod. * * $Id: eightball.C,v 1.6 2007/09/22 14:27:27 pippijn Exp $ */ #include "atheme.h" #include #include static char const rcsid[] = "$Id: eightball.C,v 1.6 2007/09/22 14:27:27 pippijn Exp $"; REGISTER_MODULE ("gameserv/eightball", false, "The Ermyth Team "); static void command_eightball (sourceinfo_t *si, int parc, char *parv[]); command_t const cmd_eightball = { "EIGHTBALL", N_("Ask the 8-Ball a question."), AC_NONE, 0, command_eightball }; E cmdvec gs_cmdtree; E cmdvec cs_cmdtree; E helpvec gs_helptree; E helpvec cs_helptree; bool _modinit (module *m) { gs_cmdtree << cmd_eightball; cs_cmdtree << cmd_eightball; help_addentry (gs_helptree, "EIGHTBALL", "help/gameserv/eightball", NULL); help_addentry (cs_helptree, "EIGHTBALL", "help/gameserv/eightball", NULL); return true; } void _moddeinit () { gs_cmdtree >> cmd_eightball; cs_cmdtree >> cmd_eightball; help_delentry (gs_helptree, "EIGHTBALL"); help_delentry (cs_helptree, "EIGHTBALL"); } /* * Handle reporting for both fantasy commands and normal commands in GameServ * quickly and easily. Of course, sourceinfo has a vtable that can be manipulated, * but this is quicker and easier... -- nenolod */ static void gs_command_report (sourceinfo_t *si, char const * const fmt, ...) { va_list args; char buf[BUFSIZE]; va_start (args, fmt); vsnprintf (buf, BUFSIZE, fmt, args); va_end (args); if (si->c != NULL) phandler->privmsg (chansvs.nick, si->c->name, "%s", buf); else command_success_nodata (si, "%s", buf); } static void command_eightball (sourceinfo_t *si, int parc, char *parv[]) { static char const * const eightball_responses[] = { N_("Absolutely yes!"), N_("Prospect looks hopeful."), N_("I'd like to think so."), N_("Yes, yes, yes, and yes again."), N_("Most likely."), N_("All signs point to yes."), N_("Yes."), N_("Without a doubt."), N_("Sometime in the near future."), N_("Of course!"), N_("Definitely."), N_("Answer hazy."), N_("Prospect looks bleak."), N_("That's a question you should ask yourself."), N_("Maybe."), N_("That question is better remained unanswered."), N_("The stars would have to align for that to happen."), N_("No."), N_("Not even on a GOOD day."), N_("It would take a disturbed person to even ask."), N_("You wish."), N_("Not bloody likely."), N_("No way."), N_("Never."), N_("NO!"), N_("Over my dead body."), N_("We won't go there"), N_("No chance at all!") }; gs_command_report (si, "%s", eightball_responses[gen_rand32 () % 28]); }