vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --FeedOMatic functions used for non-En clients |
2 | --This file's contents are, for the most part, ripped from FeedOMatic |
||
3 | |||
4 | function PF_FOM_IsFood(item) |
||
5 | --DEFAULT_CHAT_FRAME:AddMessage("item.id "..item.id); |
||
6 | |||
7 | if ( PF_FOM_IsInDiet(item.id) ) then |
||
8 | --DEFAULT_CHAT_FRAME:AddMessage("IsFood=true"); |
||
9 | return true; |
||
10 | else |
||
11 | --DEFAULT_CHAT_FRAME:AddMessage("IsFood=false"); |
||
12 | return false; |
||
13 | end |
||
14 | |||
15 | end |
||
16 | |||
17 | function PF_FOM_IsInDiet(food, dietList) |
||
18 | |||
19 | if ( dietList == nil ) then |
||
20 | dietList = {GetPetFoodTypes()}; |
||
21 | end |
||
22 | if ( dietList == nil ) then |
||
23 | return false; |
||
24 | end |
||
25 | if (type(dietList) ~= "table") then |
||
26 | dietList = {dietList}; |
||
27 | end |
||
28 | |||
29 | local itemId = PetFeeder_IdFromLink(food) |
||
30 | for _, diet in dietList do |
||
31 | diet = string.lower(diet); -- let's be case insensitive |
||
32 | |||
33 | if (PF_FOM_Foods[diet] ~= nil) then |
||
34 | if (PF_FOM_Foods[diet] == itemId) then |
||
35 | return true; |
||
36 | else |
||
37 | return false; |
||
38 | end |
||
39 | else |
||
40 | return false; |
||
41 | end |
||
42 | end |
||
43 | |||
44 | return false; |
||
45 | |||
46 | end |