-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemRollInformFrame.lua
More file actions
173 lines (148 loc) · 6.78 KB
/
ItemRollInformFrame.lua
File metadata and controls
173 lines (148 loc) · 6.78 KB
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
---------------------
---PRIVATE SECTION---
---------------------
local ItemRollInformFrame = CreateFrame("FRAME", "ItemRollInformFrame", UIParent);
local frameWidth, frameHeight = 400, 247;
local buttonWidth, buttonHeight = 50, 24;
local iconWidth, iconHeight = 64, 64;
local itemLink = "|cffffffff|Hitem:6948:0000:0000:0000:0000:0:0:0:80|h[Das ist ein Dummy Item Text]|h|r";
local function onClickRoll(range)
SlashCmdList["RANDOM"](range);
ItemRollInformFrame:Hide();
end
ItemRollInformFrame:SetPoint("CENTER",0,0);
ItemRollInformFrame:SetFrameStrata("DIALOG");
ItemRollInformFrame:EnableMouse(true);
ItemRollInformFrame:SetSize(frameWidth, frameHeight);
ItemRollInformFrame:SetBackdrop({bgFile="Interface/DialogFrame/UI-DialogBox-Background",
edgeFile="Interface/BUTTONS/UI-SliderBar-Border",
tile=true,
tileSize=32,
edgeSize = 8,
insets = { left = 1, right = 1, top = 3, bottom = 3 }
});
ItemRollInformFrame:SetBackdropBorderColor(0,0,0,1);
ItemRollInformFrame:Hide();
local HeaderFontString = ItemRollInformFrame:CreateFontString("ARTWORK", nil, "GameFontNormalLarge");
HeaderFontString:SetPoint("TOP", 0, -30);
HeaderFontString:SetText(StriLiAtlasLootAdIn.Lang.ItemRollFrame.headerText);
HeaderFontString:SetWidth(frameWidth*0.9);
HeaderFontString:SetJustifyH("CENTER");
local CustomRollEditBox = CreateFrame("EDITBOX", "CustomRollEditBox", ItemRollInformFrame, "StriLi_Custom_Button_Template");
CustomRollEditBox:SetPoint("BOTTOM",-130,10);
CustomRollEditBox:SetSize(buttonWidth, buttonHeight);
CustomRollEditBox:SetText("100");
CustomRollEditBox:SetAutoFocus(false);
CustomRollEditBox:SetFontObject("ChatFontNormal");
CustomRollEditBox:SetMaxLetters(7);
CustomRollEditBox:SetScript("OnEscapePressed", function()
CustomRollEditBox:ClearFocus();
end)
CustomRollEditBox:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
insets = { left = -6}
})
CustomRollEditBox:Show();
local CustomRollButton = CreateFrame("BUTTON", "CustomRollButton", ItemRollInformFrame, "StriLi_Custom_Button_Template");
CustomRollButton:SetPoint("BOTTOM",-90,10);
CustomRollButton:SetSize(buttonWidth, buttonHeight);
CustomRollButton:SetText(StriLiAtlasLootAdIn.Lang.ItemRollFrame.buttonRoll);
CustomRollButton:SetScript("OnClick", function(self, button, down)
StriLiAtlasLoot_CustomRoll = CustomRollEditBox:GetText();
onClickRoll(StriLiAtlasLoot_CustomRoll);
end )
CustomRollButton:Show();
CustomRollEditBox:SetScript("OnEnterPressed", function()
CustomRollButton:Click();
end)
local MainRollButton = CreateFrame("BUTTON", "MainRollButton", ItemRollInformFrame, "StriLi_Custom_Button_Template");
MainRollButton:SetPoint("BOTTOM",-20,10);
MainRollButton:SetSize(buttonWidth, buttonHeight);
MainRollButton:SetText("100");
MainRollButton:SetScript("OnClick", function(self, button, down) onClickRoll(100) end)
MainRollButton:Show();
local SecRollButton = CreateFrame("BUTTON", "SecRollButton", ItemRollInformFrame, "StriLi_Custom_Button_Template");
SecRollButton:SetPoint("BOTTOM", 50,10);
SecRollButton:SetSize(buttonWidth, buttonHeight);
SecRollButton:SetText("99");
SecRollButton:SetScript("OnClick", function(self, button, down) onClickRoll(99) end);
SecRollButton:Show();
local PassRollButton = CreateFrame("BUTTON", "PassRollButton", ItemRollInformFrame, "StriLi_Custom_Button_Template");
PassRollButton:SetPoint("BOTTOM",120,10);
PassRollButton:SetSize(buttonWidth, buttonHeight);
PassRollButton:SetText(StriLiAtlasLootAdIn.Lang.ItemRollFrame.buttonPass);
PassRollButton:SetScript("OnClick", function(self, button, down) ItemRollInformFrame:Hide() end);
PassRollButton:Show();
local ItemIconFrame = CreateFrame("FRAME", "ItemIconFrame", ItemRollInformFrame);
ItemIconFrame:EnableMouse(true);
ItemIconFrame:SetPoint("LEFT",iconWidth,0);
ItemIconFrame:SetSize(iconWidth,iconHeight);
ItemIconFrame:Show();
local ItemIcon = ItemIconFrame:CreateTexture()
ItemIcon:SetTexture(GetItemIcon(6948));
ItemIcon:SetSize(iconWidth,iconHeight);
ItemIcon:SetPoint("CENTER",0,0);
ItemIcon:Show();
ItemIconFrame:SetScript("OnEnter", function()
if (itemLink) then
GameTooltip:SetOwner(ItemIconFrame, "ANCHOR_TOP")
GameTooltip:SetHyperlink(itemLink)
GameTooltip:Show()
end
end)
ItemIconFrame:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
local ItemLinkFrame = CreateFrame("FRAME", "ItemIconFrame", ItemRollInformFrame);
ItemLinkFrame:EnableMouse(true);
ItemLinkFrame:SetPoint("CENTER",iconWidth/2,0);
ItemLinkFrame:SetWidth(frameWidth/2);
ItemLinkFrame:SetHeight(iconHeight);
ItemLinkFrame:Show();
ItemLinkFrame:SetScript("OnEnter", function()
if (itemLink) then
GameTooltip:SetOwner(ItemLinkFrame, "ANCHOR_TOP")
GameTooltip:SetHyperlink(itemLink)
GameTooltip:Show()
end
end)
ItemLinkFrame:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
local ItemLink = ItemLinkFrame:CreateFontString("ItemLink", "ARTWORK", "GameFontNormalLarge");
ItemLink:SetPoint("CENTER", 0, 0);
ItemLink:SetWidth(frameWidth/2);
ItemLink:SetHeight(iconHeight);
ItemLink:SetJustifyH("CENTER");
ItemLink:SetText(itemLink);
local StriLiPersonalTallyMarkFrame = ItemRollInformFrame:CreateFontString("StriLiPersonalTallyMarkFrame", "ARTWORK", "GameFontNormal");
StriLiPersonalTallyMarkFrame:SetPoint("CENTER", 0, -iconHeight);
StriLiPersonalTallyMarkFrame:SetJustifyH("CENTER");
StriLiPersonalTallyMarkFrame:SetText("InitialDummy");
local function updateTallyMarkString()
if StriLi.master:get() ~= "" then
local playerMarks = RaidMembersDB:get(UnitName("player"));
if playerMarks == nil then return end
StriLiPersonalTallyMarkFrame:SetText(string.format(StriLiAtlasLootAdIn.Lang.ItemRollFrame.tallymarksText, playerMarks["Main"]:get(), playerMarks["Sec"]:get(), playerMarks["Token"]:get()+playerMarks["TokenSec"]:get(), playerMarks["Fail"]:get()));
StriLiPersonalTallyMarkFrame:Show();
else
StriLiPersonalTallyMarkFrame:Hide();
end
end
--------------------------------------------------------------------------------
-------------------------------- PUBLIC SECTION --------------------------------
--------------------------------------------------------------------------------
function ItemRollInformFrame_show(aItemID, headerText)
local _, localItemLink = GetItemInfo(aItemID)
itemLink = localItemLink;
ItemLink:SetText(localItemLink);
ItemIcon:SetTexture(GetItemIcon(aItemID));
updateTallyMarkString();
CustomRollEditBox:SetText(StriLiAtlasLoot_CustomRoll);
if headerText then
HeaderFontString:SetText(headerText);
else
HeaderFontString:SetText(StriLiAtlasLootAdIn.Lang.ItemRollFrame.headerText);
end
ItemRollInformFrame:Show();
end