-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathRBQpp.php
More file actions
115 lines (104 loc) · 3.81 KB
/
RBQpp.php
File metadata and controls
115 lines (104 loc) · 3.81 KB
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
<?php
namespace plugin;
use phqagent\plugin\PluginBase;
use phqagent\console\MainLogger;
use phqagent\message\Message;
use phqagent\element\User;
class RBQpp extends PluginBase{
private $log = [];
private $block = [];
public function onLoad(){
if(version_compare("2.3.3", \phqagent\VERSION) > 0){
MainLogger::alert("请升级PhQAgent框架到最新版!");
return false;
}
MainLogger::success('全新的RBQ++插件加载完成啦!');
}
public function onMessageReceive(Message $message){
if($message->getType() == Message::GROUP){
if($message->getContent() == "!rbq"){
$this->processRBQ($message);
}elseif($message->getContent() == "!block"){
$this->processBlock($message);
}
$this->logMessage($message);
}
}
private function logMessage($msg){
$group = $msg->getFrom();
$user = $msg->getSend();
if(!isset($this->log[$group->getUin()][$user->getUin()])){
$this->log[$group->getUin()][$user->getUin()] = $user;
}
if(count($this->log[$group->getUin()]) > 10){
array_shift($this->log[$group->getUin()]);
}
}
private function processRBQ($msg){
$group = $msg->getFrom();
$user = $msg->getSend();
if(!isset($this->log[$group->getUin()])){
$text = "现在还没有RBQ可供挑选, 恭喜您成为在下一次抽取100%命中的RBQ";
new Message($msg, $text, true);
return ;
}
$keys = [];
foreach($this->log[$group->getUin()] as $u){
if($user instanceof User){
$keys[] = $u;
}
}
$rbq = $keys[mt_rand(0, count($keys) - 1)];
if($rbq->getUin() == $user->getUin()){
$text = $user->getCard() . " 脸太黑, 只能当别人的RBQ, 我极大地加强了你是下一抽的概率哦~";
new Message($msg, $text, true);
unset($this->log[$group->getUin()]);
return ;
}
$text = $user->getCard() . "获得了一个 " . $this->processType() . " 的 " . $rbq->getCard() . " 作为RBQ!";
if(mt_rand(0, 100) < 5){
$text .= "\n\n[欧皇限定] " . $rbq->getCard() . "拼命挣扎, 是否要堵住它的嘴? 发送指令 !block 禁言 " . $rbq->getCard() . " 一分钟, 该指令会在下一次获得欧皇限定时覆盖.";
$this->block[$group->getUin()][$user->getUin()] = $rbq;
}
new Message($msg, $text, true);
return ;
}
private function processBlock($msg){
$group = $msg->getFrom();
$user = $msg->getSend();
if(isset($this->block[$group->getUin()][$user->getUin()])){
$rbq = $this->block[$group->getUin()][$user->getUin()];
$text = "好的! 胶布, 皮鞭, 蜡烛 ... 都准备好了哦~";
new Message($msg, $text, true);
$group->banMember($rbq, 60);
unset($this->block[$group->getUin()][$user->getUin()]);
return ;
}else{
$text = $user->getCard() . " 你根本就不是欧皇, 我极大地加强了你是下一抽的概率哦~";
new Message($msg, $text, true);
unset($this->log[$group->getUin()]);
return ;
}
}
private function processType(){
return $this->type[mt_rand(0, count($this->type) - 1)];
}
private $type = [
'女装',
'抖M',
'大JJ',
'惊天巨乳',
'贫乳',
'双马尾',
'傲娇',
'病娇',
'变态',
'智障',
'发情期',
'扶她',
'名器级',
'人妻',
'全自动',
'吃口球'
];
}