-
Notifications
You must be signed in to change notification settings - Fork 2
/
gs_sexdice.cpp
145 lines (127 loc) · 4.16 KB
/
gs_sexdice.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* gs_sexdice: a module that implements the old sexdice tcl script
* See: https://gist.github.com/Techman-/9b5863414ddb92edfc3a9e21b65377c9
*
* Copyright (C) 2019 Michael Hazell <[email protected]>
*
* You may use this module under the terms of docs/LICENSE, in the Anope source directory
*
* Configuration:
* module { name = "gs_sexdice"; showroller = false; }
* command { name = "SEXDICE"; service = "GameServ"; command = "gameserv/sexdice"; }
* fantasy { name = "SEXDICE"; command = "gameserv/sexdice"; prepend_channel = true; }
*/
#include "module.h"
class CommandGSSexDice : public Command
{
bool showroller;
public:
CommandGSSexDice(Module *creator, const Anope::string &sname = "gameserv/sexdice") : Command(creator, sname, 1, 1)
{
this->SetDesc(_("Roll the sex dice!"));
this->SetSyntax(_("\037#channel\037"));
this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
{
std::vector<Anope::string> dice1;
dice1.reserve(10);
dice1.push_back("kiss");
dice1.push_back("fondle");
dice1.push_back("lick");
dice1.push_back("suck");
dice1.push_back("touch");
dice1.push_back("nibble");
dice1.push_back("do anything you want to");
dice1.push_back("do anything you want to"); // Greater chance
std::vector<Anope::string> dice2;
dice2.reserve(10);
dice2.push_back("lips");
dice2.push_back("neck");
dice2.push_back("chest");
dice2.push_back("ears");
dice2.push_back("anywhere you want");
dice2.push_back("anywhere you want"); // Greater chance
dice2.push_back("nipple");
dice2.push_back("toe");
dice2.push_back("ass");
dice2.push_back("crotch");
const Anope::string& chan = params[0];
ChannelInfo* ci = ChannelInfo::Find(chan);
BotInfo* gs = Config->GetClient("GameServ");
if (!ci)
{
source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str());
return;
}
if (!ci->bi)
{
source.Reply(BOT_NOT_ASSIGNED);
return;
}
if (!ci->c || !ci->c->FindUser(ci->bi))
{
source.Reply(BOT_NOT_ON_CHANNEL, ci->name.c_str());
return;
}
if (!gs)
{
source.Reply("GameServ client not found");
return;
}
std::vector<User* > users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
{
ChanUserContainer* uc = it->second;
User* u = uc->user;
if(u != ci->bi) // Don't add the BotServ bot
users.push_back(u);
}
int userchoice = rand() % users.size();
User* u = users[userchoice];
// http://www.cplusplus.com/forum/beginner/89214/
int choice1 = rand() % dice1.size();
int choice2 = rand() % dice2.size();
showroller = Config->GetModule(this->owner)->Get<bool>("showroller");
if (showroller == true)
{
IRCD->SendPrivmsg(gs, ci->name, "[SEX DICE] \002%s\002 rolled the Sex Dice!", source.GetUser()->nick.c_str());
}
if (choice2 == 4 || choice2 == 5)
{
IRCD->SendPrivmsg(gs, ci->name, "[SEX DICE] \002%s\002, you have to %s \002%s\002 %s!", source.GetUser()->nick.c_str(), dice1[choice1].c_str(), u->nick.c_str(), dice2[choice2].c_str());
}
else
{
IRCD->SendPrivmsg(gs, ci->name, "[SEX DICE] \002%s\002, you have to %s \002%s\002 on the %s!", source.GetUser()->nick.c_str(), dice1[choice1].c_str(), u->nick.c_str(), dice2[choice2].c_str());
}
}
bool OnHelp(CommandSource& source, const Anope::string& subcommand) anope_override
{
this->SendSyntax(source);
source.Reply(" ");
source.Reply(_("Rolls the sex dice! Will randomly choose a user in the channel."));
return true;
}
};
class GSFantasySexDice : public Module
{
CommandGSSexDice commandgssexdice;
bool showroller;
public:
GSFantasySexDice(const Anope::string& modname, const Anope::string& creator) : Module(modname, creator, THIRD),
commandgssexdice(this)
{
this->SetAuthor("Techman");
this->SetVersion("1.0.1");
if (!ModuleManager::FindModule("gameserv"))
{
throw ModuleException("This module requires the GameServ core module to be loaded in order to function.");
}
}
void OnReload(Configuration::Conf* conf) anope_override
{
Configuration::Block* block = conf->GetModule(this);
showroller = block->Get<bool>("showroller", true);
}
};
MODULE_INIT(GSFantasySexDice)