Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
s0h2x authored Jul 6, 2022
1 parent e6c5b18 commit bc89f89
Show file tree
Hide file tree
Showing 47 changed files with 2,913 additions and 0 deletions.
Binary file added assets/Border.tga
Binary file not shown.
Binary file added assets/Comfortaa-Bold.ttf
Binary file not shown.
Binary file added assets/PTSans-Bold.ttf
Binary file not shown.
93 changes: 93 additions & 0 deletions assets/PTSans-License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright (c) 2010, ParaType Ltd. (http://www.paratype.com/public),
with Reserved Font Names "PT Sans", "PT Serif" and "ParaType".

This Font Software is licensed under the Open Font License, Version 1.1
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added assets/TargetOfTarget.blp
Binary file not shown.
Binary file added assets/TargetOfTargetSquare.tga
Binary file not shown.
Binary file added assets/UI-CastingBar-Border-Small.blp
Binary file not shown.
Binary file added assets/UI-CastingBar-Flash-Small.blp
Binary file not shown.
Binary file added assets/UI-CastingBar-Small-Shield.blp
Binary file not shown.
Binary file added assets/UI-Classes-Circles.blp
Binary file not shown.
Binary file added assets/UI-PARTYFRAME-FLASH.blp
Binary file not shown.
Binary file added assets/UI-PartyFrame.blp
Binary file not shown.
Binary file added assets/UI-Player-Status.blp
Binary file not shown.
Binary file added assets/UI-TargetingEliteFrame.blp
Binary file not shown.
Binary file added assets/UI-TargetingFrame.blp
Binary file not shown.
Binary file added assets/beige.tga
Binary file not shown.
Binary file added assets/default.tga
Binary file not shown.
Binary file added assets/dualwield01.tga
Binary file not shown.
Binary file added assets/fontAtari.ttf
Binary file not shown.
Binary file added assets/normal.ttf
Binary file not shown.
Binary file added assets/units_trinket_border.blp
Binary file not shown.
274 changes: 274 additions & 0 deletions core/anchor.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
local addon = select(2,...);
local event_ = addon:package()

-- /* lua lib */
local unpack = unpack
local pairs = pairs
local wipe = wipe
local print = print
local table = addon.table

-- /* WoW APIs */
local GetEffectiveScale = GetEffectiveScale
local StaticPopup_Show = StaticPopup_Show
local InCombatLockdown = InCombatLockdown
local UIErrorsFrame = UIErrorsFrame
local UIParent = UIParent
local CreateFrame = CreateFrame

-- /* consts */
local CANCEL = CANCEL
local LOCK = LOCK
local OKAY = OKAY
local RESET = RESET
local ERR_NOT_IN_COMBAT = ERR_NOT_IN_COMBAT
local istoggle = false
local secure = true

-- /* create screen shade */
local shadeFrame = CreateFrame('Frame')
local shadeTexture = shadeFrame:CreateTexture(nil, 'BACKGROUND', nil, -8)
shadeFrame:SetFrameStrata('BACKGROUND')
shadeFrame:SetWidth(GetScreenWidth() * UIParent:GetEffectiveScale())
shadeFrame:SetHeight(GetScreenHeight() * UIParent:GetEffectiveScale())
shadeTexture:SetAllPoints(shadeFrame)
shadeFrame:SetPoint('CENTER', 0, 0)

-- /* create screen crosshair */
local crosshairFrameNS = CreateFrame('Frame')
local crosshairTextureNS = crosshairFrameNS:CreateTexture(nil, 'TOOLTIP')
crosshairFrameNS:SetFrameStrata('TOOLTIP')
crosshairFrameNS:SetWidth(1)
crosshairFrameNS:SetHeight(GetScreenHeight() * UIParent:GetEffectiveScale())
crosshairTextureNS:SetAllPoints(crosshairFrameNS)
crosshairTextureNS:SetTexture(0, 0, 0, 1)

local crosshairFrameEW = CreateFrame('Frame')
local crosshairTextureEW = crosshairFrameEW:CreateTexture(nil, 'TOOLTIP')
crosshairFrameEW:SetFrameStrata('TOOLTIP')
crosshairFrameEW:SetWidth(GetScreenWidth() * UIParent:GetEffectiveScale())
crosshairFrameEW:SetHeight(1)
crosshairTextureEW:SetAllPoints(crosshairFrameEW)
crosshairTextureEW:SetTexture(0, 0, 0, 1)

-- /* setup screen align */
local function clear()
shadeFrame:Hide()
crosshairFrameNS:Hide()
crosshairFrameEW:Hide()
end

local function shade(r, g, b, a)
shadeTexture:SetTexture(r, g, b, a)
shadeFrame:Show()
end

local function follow()
local mouseX, mouseY = GetCursorPosition()
crosshairFrameNS:SetPoint('TOPLEFT', mouseX, 0)
crosshairFrameEW:SetPoint('BOTTOMLEFT', 0, mouseY)
end

local function crosshair(arg)
local mouseX, mouseY = GetCursorPosition()
crosshairFrameNS:SetPoint('TOPLEFT', mouseX, 0)
crosshairFrameEW:SetPoint('BOTTOMLEFT', 0, mouseY)
crosshairFrameNS:Show()
crosshairFrameEW:Show()
if (arg == 'follow') then
crosshairFrameNS:SetScript('OnUpdate', follow)
else
crosshairFrameNS:SetScript('OnUpdate', nil)
end
end

-- /* create mover elements */
local anchorlist, backup, f = {}, {}
local function create_anchor(self, text, value, anchor, width, height)
local key = 'elements_anchor'
if not _appdata[key] then _appdata[key] = {} end

-- setup frame
local mover = CreateFrame('Frame', nil, UIParent)
mover:SetWidth(width or self:GetWidth())
mover:SetHeight(height or self:GetHeight())
mover:SetBackdrop(addon.backdrop)
mover:SetBackdropColor(0.67058823529, 0.80392156862, 0.93725490196, .65)
mover:SetBackdropBorderColor(0, 1, .62, .5)

-- setup name
mover.text = mover:CreateFontString(nil, 'OVERLAY', 'pUiFont')
mover.text:SetPoint('CENTER', 0, 2)
mover.text:SetTextColor(1, .8, 0)
mover.text:SetText(text)

tinsert(anchorlist, mover)

if not _appdata[key][value] then
mover:SetPoint(unpack(anchor))
else
mover:SetPoint(unpack(_appdata[key][value]))
end
mover:EnableMouse(true)
mover:SetMovable(true)
mover:SetClampedToScreen(true)
mover:SetFrameStrata('HIGH')
mover:RegisterForDrag('LeftButton')
mover:SetScript('OnDragStart', function() mover:StartMoving() end)
mover:SetScript('OnDragStop', function()
mover:StopMovingOrSizing()
local orig, _, tar, x, y = mover:GetPoint()
_appdata[key][value] = {orig, 'UIParent', tar, x, y}
end)
mover:Hide()

self:ClearAllPoints()
self:SetPoint('CENTER', mover, 'CENTER')

return mover
end

-- /* create mover options */
local function unlock_elements()
for i = 1, #anchorlist do
local mover = anchorlist[i]
if (not mover:IsShown()) then
mover:Show()
end
end
table.copy(_appdata['elements_anchor'], backup)
f:Show()
end

local function lock_elements()
for i = 1, #anchorlist do
local mover = anchorlist[i]
mover:Hide()
end

f:Hide()
istoggle = false
clear()
end

-- /* setup mover settings */
StaticPopupDialogs['PRETTY_MOVER_RESET'] = {
text = 'Are you sure to reset all frames position?',
button1 = OKAY,
button2 = CANCEL,
OnAccept = function()
wipe(_appdata['elements_anchor'])
ReloadUI()
end,
timeout = 0,
whileDead = 1,
hideOnEscape = true,
preferredIndex = 5,
}

StaticPopupDialogs['PRETTY_MOVER_CANCEL'] = {
text = 'Are you sure to reverse your positioning?',
button1 = OKAY,
button2 = CANCEL,
OnAccept = function()
table.copy(backup, _appdata['elements_anchor'])
ReloadUI()
end,
timeout = 0,
whileDead = 1,
hideOnEscape = true,
preferredIndex = 5,
}

-- /* create mover console */
local function createconsole()
if f then return end

f = CreateFrame('Frame', nil, UIParent)
f:SetPoint('TOP', 0, -150)
f:SetSize(296, 65)
f:SetBackdrop(addon.backdrop)
f:SetBackdropColor(0, 0, 0, .7)
f:SetBackdropBorderColor(1, .71, 0, .4)
addon.console_anchor(f)

f.text = f:CreateFontString(nil, 'OVERLAY', 'pUiFont')
f.text:SetPoint('TOP', 0, -10)
f.text:SetText('Console')

-- setup buttons
local bu, text = {}, {LOCK, CANCEL, 'Grid', RESET}
for i = 1, 4 do
bu[i] = CreateFrame('Button', nil, f)
bu[i]:SetSize(70, 28)

if i==1 then
bu[i]:SetPoint('BOTTOMLEFT', 5, 5)
else
bu[i]:SetPoint('LEFT', bu[i-1], 'RIGHT', 2, 0)
end

bu.text = bu[i]:CreateFontString(nil, 'OVERLAY')
bu.text:SetFontObject('pUiFont')
bu.text:SetPoint('TOP', 0, -10)
bu.text:SetText(text[i])
end

-- create lock button
bu[1]:SetScript('OnClick', lock_elements)

-- create cancel button
bu[2]:SetScript('OnClick', function()
StaticPopup_Show('PRETTY_MOVER_CANCEL')
end)

-- create grids button
bu[3]:SetScript('OnClick', function()
if not istoggle then
istoggle = true
shade(1, 1, 1, .85)
crosshairTextureNS:SetTexture(0, 0, 0, 1)
crosshairTextureEW:SetTexture(0, 0, 0, 1)
crosshair('follow')
else
istoggle = false
clear()
end
end)

-- create reset button
bu[4]:SetScript('OnClick', function()
StaticPopup_Show('PRETTY_MOVER_RESET')
end)
end

-- /* create secure toggle function */
function event_:PLAYER_REGEN_DISABLED()
addon:toggle_anchors(true)
end

function addon:toggle_anchors(forcelock)
if secure and not forcelock then
if self:taint() then
return UIErrorsFrame:AddMessage(ERR_NOT_IN_COMBAT)
end
event_:RegisterEvent('PLAYER_REGEN_DISABLED')
createconsole()
unlock_elements()
elseif not secure then
if f and f:IsShown() then
lock_elements()
end
event_:UnregisterEvent('PLAYER_REGEN_DISABLED')
end

secure = not secure
return secure
end

SlashCmdList['PRETTY_MOVER'] = function(...)
addon:toggle_anchors()
end
SLASH_PRETTY_MOVER1 = '/mover'

addon.c_anchor = create_anchor
Loading

0 comments on commit bc89f89

Please sign in to comment.