forked from mendaloth/a-few-random-aard-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAardwolf_Auto_Clan_Donater.xml
246 lines (202 loc) · 5.74 KB
/
Aardwolf_Auto_Clan_Donater.xml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, August 08, 2010, 9:23 AM -->
<!-- MuClient version 4.52 -->
<!-- Plugin "Exp_Per_Second" generated by Plugin Wizard -->
<muclient>
<plugin
name="Aardwolf_Auto_Clan_Donator"
author="Mendaloth"
id="4ed97c202586f93e92f9a6d6"
language="Lua"
purpose="Donates a set percentage of gold gained after a certain number of pups."
save_state="y"
date_written="2010-08-08 09:22:12"
requires="4.52"
version="1.0"
>
<description trim="y">
<![CDATA[
<=================== ACTIONS ===================>
autodonate help --> Displays this information.
autodonate info --> Displays basic info on the plugin.
autodonate percent <num> --> Sets the % of your gold that will
> be donated.
autodonate powerups <num> --> Sets how many powerups you will
> gain before donating.
autodonate --> Will donate the set % regardless
> of how many powerups you have.
]]>
</description>
</plugin>
<triggers>
<trigger
enabled="y"
match="You get * gold coins from the * corpse of *."
send_to="12"
sequence="1"
>
<send>
local temp_number = string.gsub("%1", ",", "")
gold_earned = gold_earned + tonumber(temp_number) -- take out any , and replace with nothing
</send>
</trigger>
<trigger
enabled="y"
match="Some * crumbles into * gold pieces."
send_to="12"
sequence="1"
>
<send>
local temp_number = string.gsub("%2", ",", "")
gold_earned = gold_earned + tonumber(temp_number) -- take out any , and replace with nothing
</send>
</trigger>
<trigger
enabled="y"
match="A * crumbles into * gold pieces."
send_to="12"
sequence="1"
>
<send>
local temp_number = string.gsub("%2", ",", "")
gold_earned = gold_earned + tonumber(temp_number) -- take out any , and replace with nothing
</send>
</trigger>
<trigger
enabled="y"
match="Congratulations, hero. You have increased your powers!"
send_to="12"
sequence="1"
>
<send>
number_of_pups = number_of_pups +1
if (number_of_pups >= pup_limit_until_donate) then
AutoDonate()
end
</send>
</trigger>
</triggers>
<aliases>
<alias
match="autodonate percent *"
enabled="y"
send_to="12"
sequence="100"
expand_variables="y"
>
<send>
if (tonumber("%1") ~= nil) then
percent_to_donate = tonumber("%1")
SaveState()
Note("The percent to donate has been set to " .. percent_to_donate .. "%.")
else
Note("You must enter a number for the percent to donate.")
end
</send>
</alias>
<alias
match="autodonate info"
enabled="y"
send_to="12"
sequence="100"
expand_variables="y"
>
<send>
Plugin_Settings()
</send>
</alias>
<alias
match="autodonate powerups *"
enabled="y"
send_to="12"
sequence="100"
expand_variables="y"
>
<send>
if (tonumber("%1") ~= nil) then
pup_limit_until_donate = tonumber("%1")
SaveState()
Note("You will pup " .. pup_limit_until_donate .. " times before donating.")
else
Note("You must enter a number for number of times to pup before donating.")
end
</send>
</alias>
<alias
match="autodonate help"
enabled="y"
send_to="12"
>
<send>
Note(GetPluginInfo (GetPluginID(), 3))
</send>
</alias>
<alias
match="autodonate"
enabled="y"
send_to="12"
sequence="100"
expand_variables="y"
>
<send>
AutoDonate()
</send>
</alias>
</aliases>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Script -->
<script>
<![CDATA[
gold_earned = 0
session_gold_donated = 0
number_of_pups = 0
function OnPluginInstall ()
total_gold_donated = tonumber(GetVariable("total_gold_donated")) or 0
pup_limit_until_donate = tonumber(GetVariable("pup_limit_until_donate")) or 10
percent_to_donate = tonumber(GetVariable("percent_to_donate")) or 10
end
function OnPluginSaveState ()
SetVariable ("total_gold_donated", total_gold_donated)
SetVariable ("pup_limit_until_donate", pup_limit_until_donate)
SetVariable ("percent_to_donate", percent_to_donate)
end -- function OnPluginSaveState
function Plugin_Settings()
Note("You currently donate " .. percent_to_donate .. "% after every " .. pup_limit_until_donate .. " powerups.")
Note("To date you have donated " .. Shrink_Number(total_gold_donated) .. " gold using this plugin, including " .. Shrink_Number(session_gold_donated) .. " gold this session.")
Note("There are " .. (pup_limit_until_donate - number_of_pups) .. " pups until you will donate " .. (percent_to_donate/100) * gold_earned .. " gold.")
end
function AutoDonate()
local number_to_donate = round((percent_to_donate/100) * gold_earned)
SendNoEcho("clandonate " .. number_to_donate)
session_gold_donated = session_gold_donated + number_to_donate
total_gold_donated = total_gold_donated + number_to_donate
gold_earned = 0
number_of_pups = 0
SaveState()
end
function Shrink_Number(number)
if (number > 1000000000) then
--Billions
number = number/1000000000
return string.format("%.2fB", number)
elseif (number > 1000000) then
--millions
number = number/1000000
return string.format("%.2fM", number)
elseif (number > 1000) then
--thousands
number = number/1000
return string.format("%.2fK", number)
else
return number
end
end
function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
]]>
</script>
</muclient>