vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function DUF_HappinessIcon_OnEnter() |
2 | if ( this.tooltip ) then |
||
3 | GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); |
||
4 | GameTooltip:SetText(this.tooltip); |
||
5 | if ( this.tooltipDamage ) then |
||
6 | GameTooltip:AddLine(this.tooltipDamage, "", 1, 1, 1); |
||
7 | end |
||
8 | if ( this.tooltipLoyalty ) then |
||
9 | GameTooltip:AddLine(this.tooltipLoyalty, "", 1, 1, 1); |
||
10 | end |
||
11 | GameTooltip:Show(); |
||
12 | end |
||
13 | end |
||
14 | |||
15 | function DUF_HappinessIcon_Update() |
||
16 | if (not DUF_INITIALIZED) then return; end |
||
17 | local happiness, damagePercentage, loyaltyRate = GetPetHappiness(); |
||
18 | if (not UnitName("pet")) then |
||
19 | happiness = 1; |
||
20 | damagePercentage = 1.25; |
||
21 | loyaltyRate = 1; |
||
22 | elseif ( (not happiness) or DUF_Settings[DUF_INDEX].pet.HappinessIcon.hide) then |
||
23 | DUF_PetFrame_HappinessIcon:Hide(); |
||
24 | return; |
||
25 | end |
||
26 | DUF_PetFrame_HappinessIcon:Show(); |
||
27 | if ( happiness == 1 ) then |
||
28 | DUF_PetFrame_HappinessIcon_Texture:SetTexCoord(0.375, 0.5625, 0, 0.359375); |
||
29 | elseif ( happiness == 2 ) then |
||
30 | DUF_PetFrame_HappinessIcon_Texture:SetTexCoord(0.1875, 0.375, 0, 0.359375); |
||
31 | elseif ( happiness == 3 ) then |
||
32 | DUF_PetFrame_HappinessIcon_Texture:SetTexCoord(0, 0.1875, 0, 0.359375); |
||
33 | end |
||
34 | DUF_PetFrame_HappinessIcon.tooltip = getglobal("PET_HAPPINESS"..happiness); |
||
35 | DUF_PetFrame_HappinessIcon.tooltipDamage = format(PET_DAMAGE_PERCENTAGE, damagePercentage); |
||
36 | if ( loyaltyRate < 0 ) then |
||
37 | DUF_PetFrame_HappinessIcon.tooltipLoyalty = getglobal("LOSING_LOYALTY"); |
||
38 | elseif ( loyaltyRate > 0 ) then |
||
39 | DUF_PetFrame_HappinessIcon.tooltipLoyalty = getglobal("GAINING_LOYALTY"); |
||
40 | else |
||
41 | DUF_PetFrame_HappinessIcon.tooltipLoyalty = nil; |
||
42 | end |
||
43 | end |
||
44 | |||
45 | function DUF_LeaderIcon_Update(unit) |
||
46 | if (not DUF_INITIALIZED) then return; end |
||
47 | if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].LeaderIcon.hide) then return; end |
||
48 | local icon = getglobal(DUF_FRAME_DATA[unit].frame.."_LeaderIcon_Texture"); |
||
49 | local inParty = GetNumPartyMembers() + GetNumRaidMembers(); |
||
50 | if (DUF_OPTIONS_VISIBLE) then |
||
51 | icon:Show(); |
||
52 | elseif (UnitIsPartyLeader(unit) and inParty > 0) then |
||
53 | icon:Show(); |
||
54 | else |
||
55 | icon:Hide(); |
||
56 | end |
||
57 | end |
||
58 | |||
59 | function DUF_LootIcon_Update(unit) |
||
60 | if (not DUF_INITIALIZED) then return; end |
||
61 | if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].LootIcon.hide) then return; end |
||
62 | local icon = getglobal(DUF_FRAME_DATA[unit].frame.."_LootIcon_Texture"); |
||
63 | if (DUF_OPTIONS_VISIBLE) then |
||
64 | icon:Show(); |
||
65 | return; |
||
66 | end |
||
67 | icon:Hide(); |
||
68 | if (unit == "target") then return; end |
||
69 | |||
70 | local looterNum; |
||
71 | if (unit == "player") then |
||
72 | looterNum = 0; |
||
73 | elseif (unit == "party1") then |
||
74 | looterNum = 1; |
||
75 | elseif (unit == "party2") then |
||
76 | looterNum = 2; |
||
77 | elseif (unit == "party3") then |
||
78 | looterNum = 3; |
||
79 | elseif (unit == "party4") then |
||
80 | looterNum = 4; |
||
81 | end |
||
82 | |||
83 | local _, lootMaster = GetLootMethod(); |
||
84 | local inParty = GetNumPartyMembers() + GetNumRaidMembers(); |
||
85 | if ( lootMaster == looterNum and (inParty > 0) ) then |
||
86 | icon:Show(); |
||
87 | end |
||
88 | end |
||
89 | |||
90 | function DUF_PVPIcon_Update(unit) |
||
91 | if (not DUF_INITIALIZED) then return; end |
||
92 | if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].PVPIcon.hide) then return; end |
||
93 | local icon = getglobal(DUF_FRAME_DATA[unit].frame.."_PVPIcon_Texture"); |
||
94 | icon:Show(); |
||
95 | local factionGroup = UnitFactionGroup(unit); |
||
96 | if ( UnitIsPVPFreeForAll(unit) ) then |
||
97 | icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA"); |
||
98 | elseif ( factionGroup and UnitIsPVP(unit)) then |
||
99 | icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..factionGroup); |
||
100 | elseif (DUF_OPTIONS_VISIBLE) then |
||
101 | factionGroup = UnitFactionGroup("player"); |
||
102 | icon:SetTexture("Interface\\TargetingFrame\\UI-PVP-"..factionGroup); |
||
103 | return; |
||
104 | else |
||
105 | icon:Hide(); |
||
106 | end |
||
107 | end |
||
108 | |||
109 | function DUF_StatusIcon_Update(unit) |
||
110 | if (not DUF_INITIALIZED) then return; end |
||
111 | if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[unit].index].StatusIcon.hide) then return; end |
||
112 | local icon = getglobal(DUF_FRAME_DATA[unit].frame.."_StatusIcon_Texture"); |
||
113 | icon:Show(); |
||
114 | if (DUF_OPTIONS_VISIBLE) then |
||
115 | icon:SetTexCoord(.5625, .9, .08, .4375); |
||
116 | icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon"); |
||
117 | elseif (not UnitIsConnected(unit)) then |
||
118 | icon:SetTexture("Interface\\CharacterFrame\\Disconnect-Icon"); |
||
119 | icon:SetTexCoord(0, 1, 0, 1); |
||
120 | elseif (UnitHealth(unit) <= 0 or UnitIsGhost(unit)) then |
||
121 | icon:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-Skull"); |
||
122 | icon:SetTexCoord(0, 1, 0, 1); |
||
123 | elseif (unit == "player" and DL_ATTACKING) then |
||
124 | icon:SetTexCoord(.5625, .9, .08, .4375); |
||
125 | icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon"); |
||
126 | elseif (unit == "player" and DL_INCOMBAT) then |
||
127 | icon:SetTexCoord(.5625, .9, .08, .4375); |
||
128 | icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon"); |
||
129 | elseif (UnitAffectingCombat(unit)) then |
||
130 | icon:SetTexCoord(.5625, .9, .08, .4375); |
||
131 | icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon"); |
||
132 | elseif (unit == "player" and IsResting()) then |
||
133 | icon:SetTexCoord(.0625, .4375, .0625, .4375); |
||
134 | icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon"); |
||
135 | else |
||
136 | icon:Hide(); |
||
137 | end |
||
138 | end |