Debian Codegraph @

modules/gameserv/eightball.c

raw
1 /*
2 * Copyright (c) 2005-2006 William Pitcock <[email protected]> et al
3 * Rights to this code are documented in doc/LICENSE.
4 *
5 * A Magic 8 Ball. Oh noes!
6 *
7 */
8
9 #include "atheme.h"
10 #include "gameserv_common.h"
11
12 DECLARE_MODULE_V1
13 (
14 "gameserv/eightball", false, _modinit, _moddeinit,
15 PACKAGE_STRING,
16 VENDOR_STRING
17 );
18
19 static void command_eightball(sourceinfo_t *si, int parc, char *parv[]);
20
21 command_t cmd_eightball = { "EIGHTBALL", N_("Ask the 8-Ball a question."), AC_NONE, 2, command_eightball, { .path = "gameserv/eightball" } };
22
23 void _modinit(module_t * m)
24 {
25 service_named_bind_command("gameserv", &cmd_eightball);
26
27 service_named_bind_command("chanserv", &cmd_eightball);
28 }
29
30 void _moddeinit(module_unload_intent_t intent)
31 {
32 service_named_unbind_command("gameserv", &cmd_eightball);
33
34 service_named_unbind_command("chanserv", &cmd_eightball);
35 }
36
37 static void command_eightball(sourceinfo_t *si, int parc, char *parv[])
38 {
39 mychan_t *mc;
40
41 if (!gs_do_parameters(si, &parc, &parv, &mc))
42 return;
43
44 static const char *eightball_responses[28] = {
45 N_("Absolutely yes!"),
46 N_("Prospect looks hopeful."),
47 N_("I'd like to think so."),
48 N_("Yes, yes, yes, and yes again."),
49 N_("Most likely."),
50 N_("All signs point to yes."),
51 N_("Yes."),
52 N_("Without a doubt."),
53 N_("Sometime in the near future."),
54 N_("Of course!"),
55 N_("Definitely."),
56 N_("Answer hazy."),
57 N_("Prospect looks bleak."),
58 N_("That's a question you should ask yourself."),
59 N_("Maybe."),
60 N_("That question is better remained unanswered."),
61 N_("The stars would have to align for that to happen."),
62 N_("No."),
63 N_("Not even on a GOOD day."),
64 N_("It would take a disturbed person to even ask."),
65 N_("You wish."),
66 N_("Not bloody likely."),
67 N_("No way."),
68 N_("Never."),
69 N_("NO!"),
70 N_("Over my dead body."),
71 N_("We won't go there"),
72 N_("No chance at all!")
73 };
74
75 gs_command_report(si, "%s", _(eightball_responses[rand() % 28]));
76 }
77
78 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
79 * vim:ts=8
80 * vim:sw=8
81 * vim:noexpandtab
82 */