-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdata.lua
210 lines (200 loc) · 5.91 KB
/
data.lua
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
--[[
USEAGE:
you can create DATA object as a table like the sample:
DATA.xxx = {
EVENT = "XXXXXXXX", --Growl object will register this event
icon = "xxxxx", --the icon's textrues, this value must be same named with media textrue's name
source = "XXXXXXX", --the source will effect the object's click function, "PLAYER" will send whisper message to the whisper , "ITEM" will open the Gametooltip of the item ,and others won't do anything
title = function(...)
return title_text --in the function you should set your title_text as a string object
end,
content = function(...)
return content_text
-- in the function you should set your content_text as a string object
--FIXME 2012/03/06 if you need to control the timming of animation show when the event fired, you should create judge in your function and when the function return true it will be done,you can see the example codes in LOOT_INFO
-- elseif you needn't control animation,let it show when the event is firing, you just need return the string object in your function and it equivalent to return true
end,
delay = 1, -- how long does the Growl object display , it must be a int object or float object
filter = 3, -- this key will set keep firing event just show once Growl object in times , it must be a int object or float object
}
when you create the DATA object , create the same name data object in config.lua and set it true or false if you wanna enable it or not
GG HF
]]
local addon,ns = ...
local DATA = {}
DATA.WELCOME = {
EVENT = "PLAYER_LOGIN",
source = "SYSTEM",
icon = "QB",
title = function(...)
return "Welcome to use Growl for WoW"
end,
content = function(...)
return "僕と契約して、魔法少女になってよ"
end,
delay = 3.5,
}
DATA.STATUS_CHANGE = {
EVENT = "PLAYER_FLAGS_CHANGED",
source = "SYSTEM",
title = function(...)
return "Status changed"
end,
icon = "eye",
content = function(...)
local isAfk = UnitIsAFK("player")
local isDnd = UnitIsDND("player")
local isResting = IsResting()
local content = ""
if IsInInstance() then--and UnitAffectingCombat("player") then
return false
else
if isAfk then
content = "You're AFK now"
elseif isDnd then
content = "You're DND now"
elseif isResting then
content = "You're Resting now"
else
content = "Leave from AFK,DND or resting"
end
return content
end
end,
delay = 2,
}
DATA.WHISPER = {
EVENT = "CHAT_MSG_WHISPER",
source = "PLAYER",
icon = "msg",
title = function(...)
local sender = select(2,...)
local isMyFriend = false
for i = 1, GetNumFriends() do
local name = GetFriendInfo(i)
if name == sender then
isMyFriend = true
end
end
local title = ""
if isMyFriend then
title = "Whisper from friend"
elseif not isMyFriend and sender ~= UnitName("player") then
title = "Whisper from stranger"
elseif not isMyFriend and sender == UnitName("player") then
title = "Whisper from me"
end
return title
end,
content = function(...)
local msg,sender = ...
sender = UnitName(sender) == UnitName("player") and "me" or sender
local content = string.format("%s:%s",sender,msg)
return content
end,
delay = 3.5,
--filter = 5,
}
DATA.BN_WHISPER = {
EVENT = "CHAT_MSG_BN_WHISPER",
source = "PLAYER",
icon = "phone",
title = function(...)
local sender = select(2,...)
local title = "Whisper from BN RealID"
return title
end,
content = function(...)
local msg,sender = ...
local content = string.format("%s:%s",sender,msg)
return content
end,
delay = 3.5,
}
DATA.NEW_MAIL = {
EVENT = "UPDATE_PENDING_MAIL",
source = "SYSTEM",
icon = "mail",
title = function(...)
local title = "You get a new mail"
return title
end,
content = function(...)
local content = "Go the nearest mail box to recieve it"
return content
end,
delay = 3.5,
}
DATA.LOOT_INFO = {
EVENT = "CHAT_MSG_LOOT",
icon = "loot",
source = "ITEM",
title = function(...)
local title = "You get an item"
return title
end,
content = function(...)
local msg = ...
local op1,op2 = "%[","%]"
local cs = ""
if string.find(msg,"获得了物品") then
cs = "获得了物品"
elseif string.find(msg,"得到了物品") then
cs = "得到了物品"
elseif string.find(msg,"获得了") then
cs = "获得了"
else
return false
end
local index1,index2 = string.find(msg,cs)
local looter = string.sub(msg,1,index1-1)
local op1s,op1e = string.find(msg,op1)
local op2s,op2e = string.find(msg,op2)
local lootItem = string.sub(msg,op1e+1,op2e-1)
local content = ""
content = lootItem
if looter == "你" then
return content
else
return false
end
end,
delay = 3.5,
}
DATA.CURRENCY_INFO = {
EVENT = "CHAT_MSG_CURRENCY",
icon = "heart",
source = "SYSTEM",
title = function(...)
local title = "You recieve currency"
return title
end,
content = function(...)
local msg = ...
local content = ""
local op = {"%[","%]","x","%。"}
local ops = {}
for i =1, 4 do
ops[i] = {string.find(msg,op[i])}
end
local currencyIDbyType = {
["正义点数"] = 395,
["勇气点数"] = 396,
}
local currencyType = string.sub(msg,ops[1][2]+1,ops[2][1]-1) -- cut the string between "[" and "]" "[justice points]" will return "justice points"
local currencyPoints = string.sub(msg,ops[3][2],ops[4][1]-1) -- cut the number between "x" and "." "x77." will return "77"
if currencyType == "勇气点数" then
local _,allCP,_,curCP = GetCurrencyInfo(currencyIDbyType[currencyType])
content = string.format("%s:%s,%s:%s,%s:%s","获取"..currencyType,currencyPoints,"本周上限",curCP.."/1000","总计",allCP)
elseif currencyType == "正义点数" then
local allCP = select(2,GetCurrencyInfo(currencyIDbyType[currencyType]))
content = string.format("%s:%s,%s:%s","获取"..currencyType,currencyPoints,"总计",allCP)
else
content = ""
end
if content == "" then return false end
return content
end,
delay = 3.5,
}
ns.DATA = DATA