-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.lua
More file actions
268 lines (228 loc) · 10.4 KB
/
Copy pathcore.lua
File metadata and controls
268 lines (228 loc) · 10.4 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
local addonName, addon = ...
addon._G = _G
setfenv(1, addon)
print = function(...)
_G.print("|cffff7d0a" .. addonName .. "|r:", ...)
end
------------------------------------------------------------------------------------------------------------------------
chatFrames = _G.PrimalCore.chatFrames
------------------------------------------------------------------------------------------------------------------------
onAddonLoaded = {}
onPlayerLogin = {}
local handlerFrame = _G.CreateFrame("Frame")
handlerFrame:SetScript("OnEvent", function(self, event, ...)
--return self[event](self, ...)
return self[event] and self[event](self, ...)
end)
function handlerFrame:ADDON_LOADED(name)
if name ~= addonName then return end
self:UnregisterEvent("ADDON_LOADED")
----------------------------------------------------------------------------------------------------------------------
-- Changes to the WorldMapFrame. -------------------------------------------------------------------------------------
_G.WorldMapFrame:SetClampRectInsets(0, 0, 0, 0) -- Allow moving the WorldMapFrame all the way down.
_G.BlackoutWorld:SetTexture(0, 0, 0, 0) -- Remove the black bars to the sides of the world map.
local function polishFullscreenMap()
_G.SetUIPanelAttribute(_G.WorldMapFrame, "area", "center");
_G.SetUIPanelAttribute(_G.WorldMapFrame, "allowOtherPanels", true)
_G.WorldMapFrame:ClearAllPoints()
_G.WorldMapFrame:SetPoint("TOP")
_G.WorldMapFrame:SetPoint("BOTTOM")
_G.WorldMapFrame:SetSize(_G.WorldMapFrame.BorderFrame:GetSize())
_G.WorldMapFrame:EnableKeyboard(false)
--_G.WorldMapTitleButton:Show()
--_G.WorldMapFrame:SetMovable(true)
_G.WorldMapFrame:SetMovable(false)
end
_G.hooksecurefunc("WorldMap_ToggleSizeUp", polishFullscreenMap)
-- Both of this returns garbage at this point: _G.GetCVarBool("miniWorldMap"), _G.WorldMapFrame_InWindowedMode()...
--if _G.GetCVarBool("miniWorldMap") == false then
polishFullscreenMap()
_G.WorldMapFrame.MainHelpButton:Hide() -- Blizzard fails to do this until WorldMap_ToggleSizeUp() is called.
_G.WorldMapTitleButton:Hide()
--_G.WorldMapFrame:SetMovable(true)
--end
-- http://wowprogramming.com/utils/xmlbrowser/test/FrameXML/WorldMapFrame.xml
-- http://wowprogramming.com/utils/xmlbrowser/test/FrameXML/WorldMapFrame.lua
----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------
-- Fades the CompactRaidFrameManager when it doesn't have mouse focus. Some clues were taken from DejaPRFader.
_G.assert(not _G.CompactRaidFrameManager:GetScript("OnEnter"))
do
_G.CompactRaidFrameManager:SetScript("OnEnter", function(self, motion)
self:SetAlpha(1)
self:SetScript("OnUpdate", nil)
end)
_G.CompactRaidFrameManagerToggleButton:SetScript("OnEnter", function(self, motion)
_G.CompactRaidFrameManager:SetAlpha(1)
_G.CompactRaidFrameManager:SetScript("OnUpdate", nil)
end)
_G.CompactRaidFrameManager:SetScript("OnLeave", function(self, motion)
self:SetScript("OnUpdate", function(self)
if self.collapsed and not self:IsMouseOver() then
self:SetAlpha(0)
self:SetScript("OnUpdate", nil)
end
end)
end)
_G.CompactRaidFrameContainer:HookScript("OnEvent", function(self)
if not _G.InCombatLockdown() then
self:SetParent(_G.UIParent) -- This is protected.
end
end)
_G.hooksecurefunc("CompactRaidFrameManager_Expand", function(self)
self:SetAlpha(1)
end)
_G.hooksecurefunc("CompactRaidFrameManager_Collapse", function(self)
if not self:IsMouseOver() then
self:SetAlpha(0)
self:SetScript("OnUpdate", nil)
end
end)
_G.CompactRaidFrameManager:SetAlpha(0)
if self.collapsed and not self:IsMouseOver() then
self:SetAlpha(0)
self:SetScript("OnUpdate", nil)
end
end
----------------------------------------------------------------------------------------------------------------------
_G.SLASH_PRIMAL_EXTRA_DUEL1 = "/d"
function _G.SlashCmdList.PRIMAL_EXTRA_DUEL(msg, editbox)
_G.StartDuel("target")
end
_G.SLASH_PRIMAL_EXTRA_RELOAD1 = "/rl"
function _G.SlashCmdList.PRIMAL_EXTRA_RELOAD(msg, editbox)
_G.ReloadUI()
end
_G.SLASH_PRIMAL_EXTRA_LOGOUT1 = "/log"
function _G.SlashCmdList.PRIMAL_EXTRA_LOGOUT(msg, editbox)
_G.Logout()
end
-- http://wowprogramming.com/utils/xmlbrowser/test/FrameXML/ChatFrame.lua
_G.SLASH_PRIMAL_EXTRA_CALENDAR1 = "/cal"
_G.SlashCmdList.PRIMAL_EXTRA_CALENDAR = _G.SlashCmdList.CALENDAR
handlerFrame:RegisterEvent("PLAYER_LOGIN")
handlerFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
--BuffTimer1:SetPoint("TOP", UIParent, "TOP", 0, -128)
--BuffTimer1:SetScript("OnShow",BuffTimer1.Hide)
-- I was experimenting with these bindings with the left and right mouse buttons bound to arrow keys and side buttons
-- (notmally BUTTON4 and BUTTON5 to WoW) being used as left and right mouse buttons. It sucked.
--SetBinding("LEFT", "STRAFELEFT")
--SetBinding("RIGHT", "STRAFERIGHT")
--SetBinding("BUTTON2", "INTERACTMOUSEOVER") -- Could also use TURNORACTION or INTERACTTARGET.
-- Can't do this.
--local frame = CreateFrame("BUTTON", "NutsSecureClickHandler", UIParent, "SecureHandlerClickTemplate");
--frame:SetAttribute("_onclick", [=[RunBinding("SIT");RunMacroText([[/run print("Hello, world!")]])]=])
--frame:SetAttribute("_onclick", [=[RunBinding("SCREENSHOT")]=])
--frame:RegisterForClicks("AnyDown")
--SetBindingClick("`", "NutsSecureClickHandler")
for i = 1, #onAddonLoaded do
onAddonLoaded[i]()
end
self.ADDON_LOADED = nil
end
function handlerFrame:PLAYER_LOGIN()
for i = 1, #onPlayerLogin do
onPlayerLogin[i]()
end
end
local function ToggleWorldStateAlwaysUpFrame()
_G.assert(_G.WorldStateAlwaysUpFrame and _G.GhostFrame)
local wSFrame = _G.WorldStateAlwaysUpFrame
instanceType = (_G.select(2, _G.GetInstanceInfo()))
if (instanceType == "arena") and wSFrame:IsShown() then
wSFrame:Hide()
elseif instanceType ~= "arena" then
if not wSFrame:IsShown() then wSFrame:Show() end
if not wSFrame:IsMovable() then
wSFrame:SetMovable(true)
wSFrame:ClearAllPoints()
wSFrame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 128, 256)
wSFrame:SetUserPlaced(true)
_G.GhostFrame:SetMovable(true)
_G.GhostFrame:ClearAllPoints()
_G.GhostFrame:SetPoint("TOP", UIParent, 0, -64)
end
end
end
function handlerFrame:PLAYER_ENTERING_WORLD()
ToggleWorldStateAlwaysUpFrame()
----------------------------------------------------------------------------------------------------------------------
-- Changes to the Bags. ----------------------------------------------------------------------------------------------
--_G.CONTAINER_OFFSET_Y = 25
_G.UIPARENT_MANAGED_FRAME_POSITIONS.CONTAINER_OFFSET_Y = { baseY = 25, yOffset = 0, bottomEither = actionBarOffset,
isVar = "yAxis" }
-- wowprogramming.com/utils/xmlbrowser/test/FrameXML/UIParent.lua
-- wowprogramming.com/utils/xmlbrowser/test/FrameXML/ContainerFrame.lua
----------------------------------------------------------------------------------------------------------------------
--[[ TODO!
do
local wSFrame = _G.WorldStateAlwaysUpFrame
wSFrame:SetScript("OnEnter", function(self, motion)
self:SetAlpha(1)
end)
wSFrame:SetScript("OnLeave", function(self, motion)
self:SetAlpha(0)
end)
local childFrames = {wSFrame:GetChildren()}
for _, frame in _G.ipairs(childFrames) do
frame:SetScript("OnEnter", function(self, motion)
wSFrame:SetAlpha(1)
end)
frame:SetScript("OnLeave", function(self, motion)
wSFrame:SetAlpha(0)
end)
end
end
]]
----------------------------------------------------------------------------------------------------------------------
-- Enable the BattlefieldMinimap if this is a battleground -----------------------------------------------------------
do
local _, instanceType = _G.IsInInstance();
if instanceType == "pvp" then
-- This is a battleground and the BattlefieldMinimap should never be shown. Show it anyway.
if _G.GetCVar("showBattlefieldMinimap") == "0" then
-- http://wowprogramming.com/utils/xmlbrowser/test/FrameXML/WorldMapFrame.lua
if not _G.BattlefieldMinimap then
_G.BattlefieldMinimap_LoadUI()
end
_G.SetCVar("showBattlefieldMinimap", "1")
_G.BattlefieldMinimap:Show()
_G.WorldMapZoneMinimapDropDown_Update()
end
-- The BattlefieldMinimap should be shown in battlegrounds only and this isn't one.
elseif _G.GetCVar("showBattlefieldMinimap") == "1" and instanceType ~= "pvp" then
if _G.BattlefieldMinimap and _G.BattlefieldMinimap:IsShown() then
_G.BattlefieldMinimap:Hide()
--_G.WorldMapZoneMinimapDropDown_Update() -- Was this function removed? Why did we call it?
end
end
end
-- See AddOns/Blizzard_BattlefieldMinimap/Blizzard_BattlefieldMinimap.lua
----------------------------------------------------------------------------------------------------------------------
-- TODO: comment or remove this.
----------------------------------------------------------------------------------------------------------------------
local chatTypeGroups = {"SYSTEM", "BN_INLINE_TOAST_ALERT"}
for _, chatTypeGroup in _G.ipairs(chatTypeGroups) do
for _, event in _G.ipairs(_G.ChatTypeGroup[chatTypeGroup] or {}) do
if event then
_G.ChatFrame1:UnregisterEvent(event)
end
end
for index, value in _G.pairs(_G.ChatFrame1.messageTypeList) do
if _G.strupper(value) == _G.strupper(chatTypeGroup) then
print("Removing message group '" .. value .. "' from ChatFrame1: " ..
"'ChatFrame1.messageTypeList[" .. index .. "] = nil'")
_G.ChatFrame1.messageTypeList[index] = nil
end
-- http://wowprogramming.com/docs/api/RemoveChatWindowMessages
_G.RemoveChatWindowMessages(_G.ChatFrame1:GetID(), chatTypeGroup)
end
end
----------------------------------------------------------------------------------------------------------------------
end
function _G.NKPrint(message) -- For use in macros.
-- This is how to send messages to MikSBT. See LibSink-2.0.
_G.MikSBT.DisplayMessage(message, _G.MikSBT.DISPLAYTYPE_NOTIFICATION, false, 255, 255, 255, nil, "Ubuntu Medium", 2)
end
handlerFrame:RegisterEvent("ADDON_LOADED")
-- vim: tw=120 sts=2 sw=2 et