public
Description: WoW Addon - Food/water macro generator
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/buffet.git
Click here to lend your support to: buffet and make a donation at www.pledgie.com !
Make HP and MP macros use different custom texts
tekkub (author)
Mon May 26 17:46:28 -0700 2008
commit  b184e4783d05def43edd16a5eb586e6d90d708cf
tree    8de5bafeabe901918baf9f46f2ea795891434030
parent  ce1040b5f8494d218c11284ed23883f3d7d41bd9
...
3
4
5
6
 
7
8
9
...
110
111
112
113
114
 
 
115
116
117
118
119
 
120
121
122
...
127
128
129
130
 
131
132
133
...
3
4
5
 
6
7
8
9
...
110
111
112
 
 
113
114
115
116
117
118
 
119
120
121
122
...
127
128
129
 
130
131
132
133
0
@@ -3,7 +3,7 @@
0
 -- Locals --
0
 ----------------------
0
 
0
-local defaults = {macro = "#showtooltip\n%MACRO%"}
0
+local defaults = {macroHP = "#showtooltip\n%MACRO%", macroMP = "#showtooltip\n%MACRO%"}
0
 local ids, bests, allitems, items, dirty = LibStub("tekIDmemo"), {}, {}, {
0
   bandage = "2581:114,8545:1104,21991:3400,14530:2000,6451:640,3531:301,1251:66,8544:800,21990:2800,14529:1360,6450:400,3530:161",
0
   hstone = "14894:600,25881:400,23329:24,25883:1250,25880:180,15723:1400,11951:800,25882:640,25498:96,11952:425,11951:800,5509:500,5510:800,5511:250,5512:100,9421:1200,19004:110,19005:120,19006:275,19007:300,19008:550,19009:600,19010:880,19011:960,19012:1320,19013:1440,22103:2080,22104:2288,22105:2496",
0
@@ -110,13 +110,13 @@ function Buffet:Scan()
0
     end
0
   end
0
 
0
- self:Edit("AutoHP", bests.conjfood.id or bests.percfood.id or bests.food.id or bests.hstone.id or bests.hppot.id, bests.hppot.id, bests.hstone.id, bests.bandage.id)
0
- self:Edit("AutoMP", bests.conjwater.id or bests.percwater.id or bests.water.id or bests.mstone.id or bests.mppot.id, bests.mppot.id, bests.mstone.id)
0
+ self:Edit("AutoHP", self.db.macroHP, bests.conjfood.id or bests.percfood.id or bests.food.id or bests.hstone.id or bests.hppot.id, bests.hppot.id, bests.hstone.id, bests.bandage.id)
0
+ self:Edit("AutoMP", self.db.macroMP, bests.conjwater.id or bests.percwater.id or bests.water.id or bests.mstone.id or bests.mppot.id, bests.mppot.id, bests.mstone.id)
0
   dirty = false
0
 end
0
 
0
 
0
-function Buffet:Edit(name, food, pot, stone, shift)
0
+function Buffet:Edit(name, substring, food, pot, stone, shift)
0
   local macroid = GetMacroIndexByName(name)
0
   if not macroid then return end
0
 
0
@@ -127,7 +127,7 @@ function Buffet:Edit(name, food, pot, stone, shift)
0
 
0
   if pot and stone then body = body .. "\n/castsequence [combat,nomod] reset="..(stone == 22044 and "120/" or "").."combat item:"..stone..", item:"..pot end
0
 
0
- EditMacro(macroid, name, 1, self.db.macro:gsub("%%MACRO%%", body), 1)
0
+ EditMacro(macroid, name, 1, substring:gsub("%%MACRO%%", body), 1)
0
 end
0
 
0
 
...
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
...
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
0
@@ -30,39 +30,70 @@ frame:SetScript("OnShow", function()
0
   mpbutt.name = "AutoMP"
0
   mpbutt:SetScript("OnClick", OnClick)
0
 
0
- local macrolabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
0
- macrolabel:SetText("Macro")
0
- macrolabel:SetPoint("TOPLEFT", hpbutt, "BOTTOMLEFT", 5, -GAP)
0
+ local hpmacrolabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
0
+ hpmacrolabel:SetText("HP Macro")
0
+ hpmacrolabel:SetPoint("TOPLEFT", hpbutt, "BOTTOMLEFT", 5, -GAP)
0
 
0
- local editbox = CreateFrame("EditBox", nil, frame)
0
- editbox:SetPoint("TOP", macrolabel, "BOTTOM", 0, -5)
0
- editbox:SetPoint("LEFT", EDGEGAP/3, 0)
0
- editbox:SetPoint("BOTTOMRIGHT", -EDGEGAP/3, EDGEGAP/3)
0
- editbox:SetFontObject(GameFontHighlight)
0
- editbox:SetTextInsets(8,8,8,8)
0
- editbox:SetBackdrop({
0
- bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
0
- edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
0
- edgeSize = 16,
0
- insets = {left = 4, right = 4, top = 4, bottom = 4}
0
- })
0
- editbox:SetBackdropColor(.1,.1,.1,.3)
0
- editbox:SetMultiLine(true)
0
- editbox:SetAutoFocus(false)
0
- editbox:SetText(Buffet.db.macro)
0
- editbox:SetScript("OnEditFocusLost", function()
0
- local newmacro = editbox:GetText()
0
+ local YOFFSET = (hpmacrolabel:GetTop() - frame:GetBottom() - EDGEGAP/3)/2
0
+ local backdrop = {
0
+ bgFile = "Interface\\ChatFrame\\ChatFrameBackground", insets = {left = 4, right = 4, top = 4, bottom = 4},
0
+ edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16
0
+ }
0
+
0
+ local hpeditbox = CreateFrame("EditBox", nil, frame)
0
+ hpeditbox:SetPoint("TOP", hpmacrolabel, "BOTTOM", 0, -5)
0
+ hpeditbox:SetPoint("LEFT", EDGEGAP/3, 0)
0
+ hpeditbox:SetPoint("BOTTOMRIGHT", -EDGEGAP/3, YOFFSET + EDGEGAP/3)
0
+ hpeditbox:SetFontObject(GameFontHighlight)
0
+ hpeditbox:SetTextInsets(8,8,8,8)
0
+ hpeditbox:SetBackdrop(backdrop)
0
+ hpeditbox:SetBackdropColor(.1,.1,.1,.3)
0
+ hpeditbox:SetMultiLine(true)
0
+ hpeditbox:SetAutoFocus(false)
0
+ hpeditbox:SetText(Buffet.db.macroHP)
0
+ hpeditbox:SetScript("OnEditFocusLost", function()
0
+ local newmacro = hpeditbox:GetText()
0
+ if not newmacro:find("%%MACRO%%") then
0
+ Buffet:Print('Macro text must contain the string "%MACRO%".')
0
+ else
0
+ Buffet.db.macroHP = newmacro
0
+ Buffet:BAG_UPDATE()
0
+ end
0
+ end)
0
+ hpeditbox:SetScript("OnEscapePressed", hpeditbox.ClearFocus)
0
+ hpeditbox.tiptext = 'Customize the macro text. Must include the string "%MACRO%", which is replaced with the items to be used. This setting is saved on a per-char basis.'
0
+ hpeditbox:SetScript("OnEnter", mpbutt:GetScript("OnEnter"))
0
+ hpeditbox:SetScript("OnLeave", mpbutt:GetScript("OnLeave"))
0
+
0
+ local mpmacrolabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
0
+ mpmacrolabel:SetText("MP Macro")
0
+ mpmacrolabel:SetPoint("TOP", hpeditbox, "BOTTOM", 0, -GAP)
0
+ mpmacrolabel:SetPoint("LEFT", hpmacrolabel, "LEFT")
0
+
0
+ local mpeditbox = CreateFrame("EditBox", nil, frame)
0
+ mpeditbox:SetPoint("TOP", mpmacrolabel, "BOTTOM", 0, -5)
0
+ mpeditbox:SetPoint("LEFT", EDGEGAP/3, 0)
0
+ mpeditbox:SetPoint("BOTTOMRIGHT", -EDGEGAP/3, EDGEGAP/3)
0
+ mpeditbox:SetFontObject(GameFontHighlight)
0
+ mpeditbox:SetTextInsets(8,8,8,8)
0
+ mpeditbox:SetBackdrop(backdrop)
0
+ mpeditbox:SetBackdropColor(.1,.1,.1,.3)
0
+ mpeditbox:SetMultiLine(true)
0
+ mpeditbox:SetAutoFocus(false)
0
+ mpeditbox:SetText(Buffet.db.macroMP)
0
+ mpeditbox:SetScript("OnEditFocusLost", function()
0
+ local newmacro = mpeditbox:GetText()
0
     if not newmacro:find("%%MACRO%%") then
0
       Buffet:Print('Macro text must contain the string "%MACRO%".')
0
     else
0
- Buffet.db.macro = newmacro
0
+ Buffet.db.macroMP = newmacro
0
       Buffet:BAG_UPDATE()
0
     end
0
   end)
0
- editbox:SetScript("OnEscapePressed", editbox.ClearFocus)
0
- editbox.tiptext = 'Customize the macro text. Must include the string "%MACRO%", which is replaced with the items to be used. This setting is saved on a per-char basis.'
0
- editbox:SetScript("OnEnter", mpbutt:GetScript("OnEnter"))
0
- editbox:SetScript("OnLeave", mpbutt:GetScript("OnLeave"))
0
+ mpeditbox:SetScript("OnEscapePressed", mpeditbox.ClearFocus)
0
+ mpeditbox.tiptext = hpeditbox.tiptext
0
+ mpeditbox:SetScript("OnEnter", mpbutt:GetScript("OnEnter"))
0
+ mpeditbox:SetScript("OnLeave", mpbutt:GetScript("OnLeave"))
0
 
0
   local function Refresh(self)
0
     if GetMacroIndexByName("AutoHP") == 0 then hpbutt:Enable() else hpbutt:Disable() end

Comments

    No one has commented yet.